MATLAB Function Reference |
Syntax
h = waitbar(x,'title') waitbar(x,'title','CreateCancelBtn','button_callback') waitbar(...,property_name,property_value,...) waitbar(x) waitbar(x,h) waitbar(x,h,'updated title')
Description
A waitbar shows what percentage of a calculation is complete, as the calculation proceeds.
h = waitbar(x,'title')
displays a waitbar of fractional length x
. The handle to the waitbar figure is returned in h
. x
must be between 0 and 1.
waitbar(x,'title','CreateCancelBtn','button_callback')
specifying CreateCancelBtn
adds a cancel button to the figure that executes the MATLAB commands specified in button_callback
when the user clicks the cancel button or the close figure button. waitbar
sets both the cancel button callback and the figure CloseRequestFcn
to the string specified in button_callback
.
waitbar(...,property_name,property_value,...)
optional arguments property_name
and property_value
enable you to set corresponding waitbar
figure properties.
waitbar(x)
subsequent calls to waitbar(x)
extend the length of the bar to the new position x
.
waitbar(x,h)
extends the length of the bar in the waitbar h
to the new position x
.
Example
waitbar
is typically used inside a for
loop that performs a lengthy computation. For example,
h = waitbar(0,'Please wait...');
for i=1:100, % computation here %
waitbar(i/100)
end
close
(h)
See Also
Predefined Dialog Boxes for related functions
wait | waitfor |
© 1994-2005 The MathWorks, Inc.