Development Environment |
Quitting MATLAB
To quit MATLAB at any time, do one of the following:
quit
at the Command Window prompt.
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:
finishsav.m
--Includes a save
function so the workspace is saved to a MAT-file when MATLAB quits.
finishdlg.m
--Displays a confirmation dialog box that allows you to cancel quitting.
For more information, see finish
in the online Function Reference.
Toolbox Path Caching | Using the Desktop |