How does 'break' work?
Mostra commenti meno recenti
Hi, I need to know what happens after "break"? what does the loop skip to? I need it to skip to "for i = 1:50" and start from a new i. Please help me.
for i = 1:50
if a {i,5}(1) <= a{1,4}(1)
b{i,1} = a{1,1};
else
for j = 1:50
if a {i,5}(1) >= a{j,4}(1) && a{i,5}(1) <= a{j+1,4}(1)
b{i,1} = a{j+1,1};
break
end
end
end
end
Risposta accettata
Più risposte (1)
Walter Roberson
il 27 Ott 2016
0 voti
"break" lets some of the Magic Smoke out of your loop. It is sort of like letting some of the air out of your tires -- while you are driving on the highway!
1 Commento
Sherwin
il 27 Ott 2016
Categorie
Scopri di più su Loops and Conditional Statements in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!