Halt execution temporarily
state = pause('query')
oldstate = pause(newstate)
pause, by itself, causes the currently executing function to stop and wait for you to press any key before continuing. Pausing must be enabled for this to take effect. (See pause on, below). pause without arguments also blocks execution of Simulink® models, but not repainting of them.
Typing pause(inf) puts you into an infinite loop. To return to the MATLAB® prompt, type Ctrl+C.
pause off disables the pausing of MATLAB execution via the pause and pause(n) commands. This allows normally interactive scripts to run unattended. Pausing remains disabled until you enter pause on in your function or at the command line, or start a new MATLAB session.
pause query displays 'on' if pausing is currently enabled. Otherwise, it displays 'off'.
state = pause('query') returns 'on' in character array state if pausing is currently enabled. Otherwise, the value of state is 'off'.
oldstate = pause(newstate), enables or disables pausing, depending on the 'on' or 'off' value in newstate, and returns the former setting (also either 'on' or 'off') in character array oldstate.
The accuracy of pause is subject to the scheduling resolution of the operating system you are using, and also to other system activity. It cannot be guaranteed with 100% confidence. Asking for finer resolutions shows higher relative error.
While MATLAB is paused, the following continue to execute:
Repainting of figure windows, Simulink block diagrams, and Java® windows
HG callbacks from figure windows
Event handling from Java windows