pause

Interrupts execution of a script or code.

Syntax

pause()

pause(n)

Inputs

n
Pauses execution for n seconds.
Type: Positive scalar

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.
Pause til a character is entered by the user:
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.