카테고리 없음

Button에 Running 표시

오늘보다 나은 내일 2013. 4. 3. 22:32

function [] = pb_call(varargin)

h = varargin{1}; % Get the caller's handle.

col = get(h,'backg');  % Get the background color of the figure.

set(h,'str','RUNNING...','backg',[1 .6 .6]) % Change color of button. 

% The pause (or drawnow) is necessary to make button changes appear.

% To see what this means, try doing this with the pause commented out.

pause(.01)  % FLUSH the event queue, drawnow would work too.

% Here is where you put whatever function calls or processes that the

% pushbutton is supposed to activate. 

% Next we simulate some running process.  Here just sort a vector.

A = rand(30000000,1);

A = sort(A); %#ok 

set(h,'str','Push Me','backg',col)  % Now reset the button features.