This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.


Terminate MATLAB program


quit cancel
quit force


quit terminates the MATLAB® program. Call quit from the MATLAB command prompt.

The quit function does not automatically save the workspace.

You can add the following features to the quit and exit functions.

  • Display this confirmation dialog box.

    To display this box, check the box for Confirm before exiting MATLAB from the General Preferences panel, and then click OK.

  • Save the workspace or perform other actions before quitting by creating a finish.m script. For more information, see finish.

To interrupt a MATLAB command, see Stop Execution.

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

quit force bypasses finish.m and terminates MATLAB. Use this syntax to override the finish script if the script does not let you quit.


  • MATLAB Online does not support displaying a confirmating dialog box or using a finish.m script. Before logging out, MATLAB Online™ saves open files and session data.

Alternative Functionality

Click the close button on the MATLAB desktop.

See Also

| |

Introduced before R2006a