MATLAB Function Reference |
Syntax
waitfor(h) waitfor(h,'PropertyName') waitfor(h,'PropertyName',PropertyValue)
Description
The waitfor
function blocks the caller's execution stream so that command-line expressions, callbacks, and statements in the blocked M-file do not execute until a specified condition is satisfied.
waitfor(h)
returns when the graphics object identified by h
is deleted or when a Ctrl-C is typed in the Command Window. If h
does not exist, waitfor
returns immediately without processing any events.
waitfor(h,'PropertyName'),
in addition to the conditions in the previous syntax, returns when the value of 'PropertyName'
for the graphics object h
changes. If 'PropertyName'
is not a valid property for the object, waitfor
returns immediately without processing any events.
waitfor(h,'PropertyName',PropertyValue),
in addition to the conditions in the previous syntax, waitfor
returns when the value of 'PropertyName'
for the graphics object h
changes to PropertyValue
. waitfor
returns immediately without processing any events if 'PropertyName'
is set to PropertyValue
.
Remarks
While waitfor
blocks an execution stream, other execution streams in the form of callbacks may execute as a result of various events (e.g., pressing a mouse button).
waitfor
can block nested execution streams. For example, a callback invoked during a waitfor
statement can itself invoke waitfor
.
See Also
waitbar | waitforbuttonpress |