Block command prompt until timer stops running
wait( blocks the
command prompt until timer,
t, stops running. If
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)
Notice that 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. You must start the timer before calling the wait command.
Notice that after the timer starts, the MATLAB prompt disappears until the timer stops.
Delete the timer.