Skip to Main Content Skip to Search
Product Documentation

finish - Termination file for MATLAB program

Description

When the MATLAB program quits, it runs a script called finish.m, if the script exists and is on the search path MATLAB uses 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:

Tips

When using Handle Graphics features in finish.m, use uiwait, waitfor, or drawnow so that figures are visible. See the reference pages for these functions for more information.

Examples

Two sample termination files are provided with MATLAB in matlabroot/toolbox/local.

To create a termination file, make a copy of one of these sample files, changing the name to finish.m, and add it to the path to use it. You can modify the file to include any operations you want the termination file to perform.

See Also

exit | quit | startup

How To


[1] UNIX is a registered trademark of The Open Group in the United States and other countries.

  


Free MATLAB Interactive Kit

Explore how to use MATLAB to make advancements in engineering and science.


Download free kit

Trials Available

Try the latest version of MATLAB and other MathWorks products.


Get trial software
 © 1984-2012- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS