Search All of the Math Forum:
Views expressed in these public forums are not endorsed by
Drexel University or The Math Forum.
|
|
Markus
Posts:
18
Registered:
3/27/12
|
|
Re: pause & resume for-loop determined by if case
Posted:
Apr 17, 2012 11:17 AM
|
|
"Steven_Lord" <slord@mathworks.com> wrote in message <jmjt41$pqo$1@newscl01ah.mathworks.com>... > > > "Markus " <markusmichael86@googlemail.com> wrote in message > news:jmj9s2$f81$1@newscl01ah.mathworks.com... > > Dear Mathlabs, > > > > so far I achieved a kindof working loop, which runs during case 1 (GUI > > togglebutton is "on") and which halts during case 2 (GUI togglebutton is > > "off") by using 'pause' for case 2! Generally it should resume the for > > loop when the button is pressed which switches to case 1 again. I realize > > that 'pause' is not optimal here as unfortunately the execution is not > > really stopped, only paused (which can be seen in the command window) and > > by waiting for subsequent action it gets stuck in itself and is kind of > > blocked..! Furthermore it should be resumed at the calculation step it was > > stopped at (parameter 's'), so far it just started anew..! I also > > considered 'while' and stuff but didn't get any further... > > Can you help me here, please?!? > > *snip* > > Look at the WAITFOR or UIWAIT functions. > > -- > Steve Lord > slord@mathworks.com > To contact Technical Support use the Contact Us link on > http://www.mathworks.com
Thanks to both, it is the right way, working nearly as perfectly as I wanted it to! There always is a small 'but', but it's a very small one though ;-)
I decided to use waitfor(handles.togglebutton, 'Value', 1); the remaining tiny problem is that I want the interrupted for-loop to resume at the current value 's' where it was stopped at, not from anew (from 1 onwards..) ! Can someone give a final hint?? Thank you very much! Cheers
|
|
|
|