MATLAB Function Reference    
quit

Terminate MATLAB

Graphical Interface

As an alternative to the quit function, use the close box or select Exit MATLAB from the File menu in the MATLAB desktop.

Syntax

Description

quit terminates MATLAB after running finish.m, if finish.m exists. The workspace is not automatically saved by quit. To save the workspace or perform other actions when quitting, create a finish.m file to perform those actions. If an error occurs while finish.m is running, quit is canceled so that you can correct your finish.m file without losing your workspace.

quit cancel is for use in finish.m and cancels quitting. It has no effect anywhere else.

quit force bypasses finish.m and terminates MATLAB. Use this to override finish.m, for example, if an errant finish.m will not let you quit.

Remarks

When using Handle Graphics in finish.m, use uiwait, waitfor, or drawnow so that figures are visible. See the reference pages for these functions for more information.

Examples

Two sample finish.m files are included with MATLAB. Use them to help you create your own finish.m, or rename one of the files to finish.m to use it.

See Also
finish, save, startup


  questdlg quiver