From: Will Liu on
How could I use toggle button as a switch?
I write the follows under toggle button callback.

a=0;
while (get(handles.togglebutton1,'Value'))

a=a+1

end

It should count when the button is pressed down and stop when it's up.
However it continues counting.

I also try adding following in the loop.

get(handles.togglebutton1,'Value')

It turns out no matter what state is the button. It always return 1. Why is that?

Thanks in advance.
From: Matt Fig on
I suspect you need to flush the event queue. Put in a drawnow or pause(.001), and see question #12.


http://www.mathworks.com/matlabcentral/fileexchange/24861-41-complete-gui-examples
 | 
Pages: 1
Prev: dlmread precision
Next: slope