-
5 Comments
Doesn't this kind of trick get boring after a while?
actually, this is the first time i've used it without essentially copying Alfonso's code, so it's still new and fresh for me =P
Can someone explain to me how this function works (even if it is a trick)? I'm trying to parse through the code, but how it works isn't clear to me.
the sparse function places the values (third input) into the row and column specified, 1st and second inputs respectively. if there are any overlapping coordinates then it sums them, so I created a matrix that, when fed into sparse, would sum the rows, sum the columns, and sum the diagonals in each direction. Then I Cody-fied it (teehee) by changing these indices into a string of characters, which Cody sizes as small, and subtracting a base character from it. does that make sense now?
it might make more sense to look at one of my other solutions that uses the str2num function instead of the letter thing...
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!