Desktop Tools and Development Environment Previous page   Next Page

Quitting MATLAB

To quit MATLAB at any time, do one of the following:

MATLAB closes after

Confirm Quitting MATLAB

To set a preference that displays a confirmation dialog box when you quit MATLAB, select File -> Preferences -> General -> Confirmation Dialogs, select the Confirm before quitting check box, and click OK. MATLAB then displays the following dialog box when you quit.

For more information, see Confirmation Dialogs.

You can also display your own quitting confirmation dialog box using a finish.m script, as described in the following section.

Running a Script When Quitting MATLAB

When MATLAB quits, it runs the script finish.m, if finish.m exists in the current directory or anywhere on the MATLAB search path. You create the file finish.m. It contains statements to run when MATLAB terminates, such as saving the workspace or displaying a confirmation dialog box. There are two sample files in $matlabroot/toolbox/local that you can use as the basis for your own finish.m file:

For more information, see the finish reference page.


Previous page  Toolbox Path Caching in MATLAB Desktop Next page

© 1994-2005 The MathWorks, Inc.