Break loop with a click of a button?
2 ビュー (過去 30 日間)
古いコメントを表示
I am using GUIDE to make a GUI. I have two buttons. The first one has a while loop ongoing with pause(). The second button I would like to make it so that the first button's loop is stopped immediately. What are some best ways I can achieve this?
0 件のコメント
回答 (1 件)
KSSV
2016 年 8 月 12 日
You can put a button and call 'break'....loop will exit once it finds break..
Eg:
for i = 1:100
disp(i)
if i == 77
disp('Got break, I am exiting')
break
end
end
2 件のコメント
KSSV
2016 年 8 月 16 日
Yes...it is possible...make a function, type break in it and call this function by clicking second button.
参考
カテゴリ
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!