For with Break
2 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Hi all.Please Help me.
How I can use for with break. "
for i=1:n;
%action
if H == 1 ; break
end
end
Risposta accettata
Teja Muppirala
il 7 Mag 2011
Seems like you've got the right idea:
for n=1:100
disp(n)
if n == 7
disp('Hello everybody')
break
end
end
2 Commenti
Teja Muppirala
il 7 Mag 2011
One more example:
n = 100;
for k=1:n
k
H = k^2;
if H == 36
disp('H is now 36. I will stop')
break
end
end
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Logical in Help Center e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!