|MATLAB Function Reference|
MATLAB termination M-file
When MATLAB quits, it runs a script called
finish.m, if the script exists and is on the MATLAB search path or in the current directory. This is a file you create yourself that instructs MATLAB to perform any final tasks just prior to terminating. For example, you might want to save the data in your workspace to a MAT-file before MATLAB exits.
finish.m is invoked whenever you do one of the following:
exitat the Command Window prompt
When using Handle Graphics in
drawnow so that figures are visible. See the reference pages for these functions for more information.
finish.m files are provided with MATLAB in
$matlabroot/toolbox/local. Use them to help you create your own
finish.m, or rename one of the files to
finish.m and add it to the path to use it:
finishsav.m--Saves the workspace to a MAT-file when MATLAB quits.
finishdlg.m--Displays a dialog allowing you to cancel quitting and saves the workspace. See also the MATLAB general preference for confirmation dialogs for quitting.
Quitting MATLAB in the MATLAB Desktop Tools and Development Environment documentation
© 1994-2005 The MathWorks, Inc.