MATLAB Function Reference |
Graphical Interface
As an alternative to the quit
function, use the Close box or select Exit MATLAB from the File menu in the MATLAB desktop.
Syntax
Description
quit
terminates MATLAB after running finish.m
, if finish.m
exists. The workspace is not automatically saved by quit
. To save the workspace or perform other actions when quitting, create a finish.m
file to perform those actions. For example, you can display a dialog box to confirm quitting using a finish.m
file--see the following examples for details. If an error occurs while finish.m
is running, quit
is canceled so that you can correct your finish.m
file without losing your workspace.
quit
is for use in cancel
finish.m
and cancels quitting. It has no effect anywhere else.
quit
bypasses force
finish.m
and terminates MATLAB. Use this to override finish.m
, for example, if an errant finish.m
will not let you quit.
Remarks
When using Handle Graphics in finish.m
, use uiwait
, waitfor
, or drawnow
so that figures are visible. See the reference pages for these functions for more information.
See Also
Examples
Two sample finish.m
files are included with MATLAB. Use them to help you create your own finish.m
, or rename one of the files to finish.m
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; it uses quit cancel
and contains the following code:
See Also
finish
, save
, startup
questdlg | quiver |
© 1994-2005 The MathWorks, Inc.