The Math Forum

Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Math Forum » Discussions » Software » comp.soft-sys.matlab

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: While loop stopped by a GUI button
Replies: 3   Last Post: Jan 21, 2013 9:25 PM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Titus Edelhofer

Posts: 1,639
Registered: 1/25/05
Re: While loop stopped by a GUI button
Posted: Apr 7, 2005 8:04 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply


add a drawnow at the end of your while loop so the program flushes events...


"Cédric L" <> schrieb im Newsbeitrag
> 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 ?

Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© The Math Forum at NCTM 1994-2018. All Rights Reserved.