stop for loop if a thing happens
Afficher commentaires plus anciens
for example:
for i=1:10
a=i+1
if a>5
exit from loop % *which command do this*
end
end
Réponse acceptée
Plus de réponses (2)
Wesley Ooms
le 8 Sep 2011
0 votes
the command is 'return' i guess
Wesley Ooms
le 8 Sep 2011
0 votes
i looked it up for you. the command is 'break' :)
2 commentaires
Oleg Komarov
le 8 Sep 2011
@Weasley: please edit your answers in place of creating new ones.
feras almasri
le 4 Avr 2015
plz answer him instead of saying this
Catégories
En savoir plus sur Loops and Conditional Statements dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!