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.

quit

Terminate MATLAB program

Syntax

quit
quit cancel
quit force
quit(code)
quit(code,"force")

Description

quit terminates the MATLAB® program. The quit function does not automatically save the workspace.

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.

quit(code) returns the specified value as the MATLAB exit code.

quit(code,"force") bypasses finish.m and terminates MATLAB with the exit code.

Example: quit(0,"force")

Input Arguments

collapse all

Exit code, specified as a signed integer. On Windows®platforms, MATLAB returns values in the range of INT_MIN to INT_MAX (-2147483647 to 2147483647). On Linux® and macOS platforms,​ MATLAB returns values between 0 and 255.

The exit code is returned by default on macOS and Linux. On Windows, start MATLAB with the -wait option.

Example: quit(1)

Limitations

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

Alternatives

Click the close button on the MATLAB desktop.

See Also

| |

Introduced before R2006a