Development Environment    

Quitting MATLAB

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

MATLAB closes immediately, without issuing a warning. If you want to see a warning, use the finishdlg.m script, as described in the next paragraph.

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 functions 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 finish in the online Function Reference.


  Toolbox Path Caching Using the Desktop