How to stop a for loop by press a button APP designer ?
22 次查看(过去 30 天)
显示 更早的评论
Hi Everyone,
Do you know how to stop a for loop by press a button in APP designer ?
I do a research but don't find any solution yet
Thanks !
0 个评论
采纳的回答
CAM
2022-8-16
Make the Stop button a toggle button.
Within the FOR loop, check the status of the Stop button. If it is toggled-on, then break out of the FOR loop.
After the FOR loop, toggle-off the Stop button.
[Please note that this is untested code]
for a = 1:loopCount
% << your main code >>
if app.tglStop.Value == 1
break
end
end % a
app.tglStop.Value = 0;
Hope this helps.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Develop Apps Using App Designer 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!