GUI, interuption while loop

  • Follow


Hi all, 

in GUI, I try to interuption for while loop...let's say..

a program initiate while loop when button A are pushed, and i want to stop/interupt the loop by pushing button B

> buttonA (tag=0) 
  ----->do while loop until button B is pushed ( while tag==1 lopp ~~~)
 when button B is pushed(tag=1) ---> loop stops

but the problem is once a button A is pushed and start the while-loop, it never check if the button B is pushed so the loop goes infinity..

how should I solved the problem?
i just run a while-loop and want to stop it by pushing another button.

Thanks in advance
0
Reply james 8/22/2010 4:09:04 AM

On 21/08/10 11:09 PM, james han wrote:

> in GUI, I try to interuption for while loop...let's say..
>
> a program initiate while loop when button A are pushed, and i want to
> stop/interupt the loop by pushing button B
>
>> buttonA (tag=0)
> ----->do while loop until button B is pushed ( while tag==1 lopp ~~~)
> when button B is pushed(tag=1) ---> loop stops
>
> but the problem is once a button A is pushed and start the while-loop,
> it never check if the button B is pushed so the loop goes infinity..
>
> how should I solved the problem?

See pause() and drawnow() to allow interrupts.

You might also want to look in the Matlab File Exchange (FEX) for some 
of the routines to check to see if key presses are waiting.
0
Reply Walter 8/22/2010 5:20:57 AM


1 Replies
514 Views

(page loaded in 0.034 seconds)

Similiar Articles:













7/24/2012 4:22:59 PM


Reply: