Stop a while loop using a GUI
Show older comments
Hey everyone,
I need to stop a while loop using a 'Stop' button in a GUI and i was wondering what are the best ways of doing that.
Accepted Answer
More Answers (2)
Birkan GOCERLER
on 21 Sep 2014
1 vote
Sean de Wolski
on 24 Jan 2013
Have the while-loop check if a togglebutton uicontrol has been pushed (i.e. what is it's value). If it has the loop will end
while(get(handles.togglebutton,'value')); %handles.togglebutton is handle to button
do_stuff;
drawnow; %force event queue update
end
Categories
Find more on Interactive Control and Callbacks in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!