I have a while loop that takes a while to run each iteration, about 60 seconds, and I want to be able to stop the loop at any time witout using CTRL+C.
at the moment I'm using:
ButtonHandle = uicontrol('Style', 'PushButton', ... 'String', 'Stop loop', ... 'Callback', 'delete(gcbf)'); while (ishandle(ButtonHandle)) (run certain processes) pause(1) end
While clicking the stop loop button, the loop still doesn't break.
Any idea on how can I use the stop loop button to break the loop?
Best Answer