Block command prompt until timer stops running
wait( blocks the command prompt until timer
t stops running. If
t is an array of timer objects,
wait blocks the MATLAB® command line until each timer in
t has stopped running.
To block the command line, the timer object must first start by using
startat before calling the
wait method. If the timer is not running,
returns to the command line immediately.
Block Command Prompt While Timer Runs
Create a timer that waits 10 seconds, and then displays a message. Start the timer and wait for it to finish.
T = timer('TimerFcn',@(~,~)disp('Fired.'),'StartDelay',10); start(T)
After the timer starts, the MATLAB prompt returns.
Start the timer and use the wait method to block anyone from entering commands at the MATLAB command line. Before calling the wait command, you must start the timer.
After the timer starts, the MATLAB prompt is not visible until the timer stops.
Delete the timer.
t — timer object
timer object | array of timer objects
Timer, specified as a timer object or array of timer objects.
Introduced before R2006a