this don't work
For with Break
2 ビュー (過去 30 日間)
古いコメントを表示
Hi all.Please Help me.
How I can use for with break. "
for i=1:n;
%action
if H == 1 ; break
end
end
採用された回答
Teja Muppirala
2011 年 5 月 7 日
Seems like you've got the right idea:
for n=1:100
disp(n)
if n == 7
disp('Hello everybody')
break
end
end
2 件のコメント
Teja Muppirala
2011 年 5 月 7 日
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
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Startup and Shutdown についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!