The Math Forum

Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Math Forum » Discussions » Software » comp.soft-sys.matlab

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: double for loop
Replies: 5   Last Post: Sep 9, 2013 10:29 AM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]

Posts: 9,850
Registered: 6/7/07
Re: double for loop
Posted: Sep 9, 2013 8:58 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

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.


Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© The Math Forum at NCTM 1994-2018. All Rights Reserved.