Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

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


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

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


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 ?






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

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.