Date: Apr 7, 2005 7:59 AM
Author: C�dric L
Subject: While loop stopped by a GUI button

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 ?