PDA

View Full Version : MATLAB - Please Help!!!!!!!!!!!


mypeace
15 Oct 2008, 5:17am
Define

>> a=1:12

How many times do each of the following loops execute?

for i=a
i.^2
end


for i=a'
i.^2
end

Would you please explain the steps?

shwaip
15 Oct 2008, 6:55am
...

run it?

LobStoR
15 Oct 2008, 4:59pm
run it?

Agreed... add a line to display what iteration you're on, and run it.

Thinking like this is fundamental to learning a language. Test and observe (adding extra lines to allow you to see what's happening, if necessary).