MATLAB Answers


problem with operations with a for loop

Asked by Natalia
on 18 Apr 2013

I'm performing a number of operations inside of a for loop. All the operations are being performed with the exception of the last loop.

e.g if I have within a loop something like this

for t=1:4

.....some code....

unmated=find(fem(:,3,t)==0) fem(:,8,t)=fem(:,1,t); %replacing fem(unmated,8,t)=0;

....more code... end

the operations are only performed for the first 3 loops but not for the last one.

Any ideas?


  1 Comment

It is difficult to read the code because of poor formatting. However, I cannot spot the reason why the loop is not executed for t=4. I guess, the reason is to find outside the code you show.

Log in to comment.


0 Answers

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Win prizes and improve your MATLAB skills

Play today