Search All of the Math Forum:
Views expressed in these public forums are not endorsed by
Drexel University or The Math Forum.
|
|
|
|
Re: While loop stopped by a GUI button
Posted:
Apr 7, 2005 8:04 AM
|
|
Hi,
add a drawnow at the end of your while loop so the program flushes events...
Titus
"Cédric L" <cedric.louyot@NOSPAMgmail.com> schrieb im Newsbeitrag news:ef01731.-1@webx.raydaftYaTP... > I'm trying to run a while-loop and I want to be able to stop it > thanks to a gui button. I'd like not to use GUIDE in order to really > understand everything I'm doing. Therefore I tried the following > piece of code : > > First attempt: > > pause = 0; > > togglebutton1 = uicontrol('Style', 'togglebutton', 'Callback', 'pause > = 1', ...); > > while pause == 0 > % My while-loop > end > > When I press my toggle button I can check in the Matlab main window > that the pause variable turns to 1 but my program does not exit the > while loop. Why is that so ? > > Does anybody have a solution to that problem ? > > Moreover what I'd really want to do is a while-loop that I can > start/stop/restart thanks to a toggle button. Any ideas ?
|
|
|
|