Prev: Non Linear FIR filter
Next: values from number regions
From: Christophe on 28 Jul 2010 04:41 Sorry to up this old post but i have a question concerning this method. It works well but I have a GUI with 2 buttons, one to START the loop and one to STOP it. This method works only once because after pushing the stop button the first time, the object is deleted. I was thinking to create a new object, just after deleting it but it does not work. I guess I have some problems to update my GUI data. Please could someone help me ? Thank you in advance. "Matt Fig" <spamanon(a)yahoo.com> wrote in message <hi863q$sj9$1(a)fred.mathworks.com>... > The drawnow command flushes the graphics event queue. The pause command will also trigger a flushing of the queue, so you don't need both in the loop. To see what happens if you don't flush the event queue, take these two lines out and run the code. > > > > > > function [] = stoploopgui() > S.fh = figure('menubar','none',... > 'units','pix',... > 'pos',[400 400 100 50]); > S.pb = uicontrol('string','stop',... > 'callback',{@pb_call},... > 'units','pixels',... > 'position',[10 10 80 30]); > %%%%%%%%%%%%%%%%%%%%%%%%%%%%%% > S.pb(2) = uicontrol('visible','off'); > n = 1; > drawnow; % Draw the GUI before we enter the loop! > for ii = 1:inf > if ~ishandle(S.pb(2)) > break; > end > % drawnow; > n = n + 1; > end > disp(n) > %%%%%%%%%%%%%%%%%%%%%%%%%%%%%% > > function [] = pb_call(varargin) > % Callback for pushbutton > delete(S.pb(2)) > end > end
|
Pages: 1 Prev: Non Linear FIR filter Next: values from number regions |