Search All of the Math Forum:
Views expressed in these public forums are not endorsed by
NCTM or The Math Forum.


dpb
Posts:
9,242
Registered:
6/7/07


Re: double for loop
Posted:
Sep 9, 2013 8:58 AM


On 9/9/2013 6:28 AM, cwc wrote: ... >> > Can someone explain to me the mechanics for a double for loop? >> > >> > [x,y] = size(z) >> > for ii = 1:x; >> > for jj = 1:y; >> > newz = z(ii,jj) >> > end >> > end >> > ...
> I can't seem to understand how the new matrix can become twice the size.
W/ the above code it can't.
And, in fact, in the above code newz will end up being a single value since you didn't subscript it the assignment will overwrite the variable each pass.




