pause
Interrupts execution of a script or code.
Syntax
pause()
pause(n)
Inputs
- n
- Pauses execution for n seconds.
Examples
Pause for a given number of seconds:
n = 10;
printf('Pause execution for %d seconds...', n);
tic(); % Start timer
pause(n)
toc() % End timer
Pause execution for 10 seconds...
Elapsed time is 10 seconds.
printf('Pause execution, type something to continue execution...');
pause()
Pause execution, type something to continue execution...
Comments
If no input arguments are passed, the execution is paused till the the user types any character. If an optional argument of n is passed, the execution of the script will be paused for n seconds. Valid values of n are positive scalars.