pause

Purpose

Halt execution temporarily.

Synopsis

pause
pause(n)
pause on 
pause off

Description

pause causes M-files to stop and wait for you to press any key before continuing.

pause(n) pauses for n seconds before continuing.

pause off indicates that any subsequent pause or pause(n) commands do not actually pause. This allows normally interactive scripts to run unattended.

pause on indicates that subsequent pause commands do pause.

Examples

An important use of pause is to halt M-files temporarily when graphics commands are encountered. If pause is not used, the graphics may not be visible. An example of this is

for n = 3:22
    mesh(magic(n))
    pause
end

(c) Copyright 1994 by The MathWorks, Inc.