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.
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, specified as a timer object or array of timer objects.