mardi 30 août 2016

How to go back to the first for loop from a nested for loop in MATLAB?

I have 2 for loops in a code, and I want to go back to the first loop in the second loop (in a certain condition). How should I do that? The following code is what I use.

function func(x)
for i=1:9
   for j = 2:10
       differences = abs(x(j)-x(i));
       if differences >= 0.5
       max_num = x(j);
       %%  From here go back to the second line and start from i+1
       else
       continue; 
   end
end
end
end   

Aucun commentaire:

Enregistrer un commentaire