28.12.2012 Views

Figure Properties - SERC

Figure Properties - SERC

Figure Properties - SERC

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

2finish<br />

Purpose MATLAB termination M-file<br />

Description When MATLAB quits, it runs a script called finish.m, if it exists and is on the<br />

MATLAB search path or in the current directory. This is a file that you create<br />

yourself in order to have MATLAB perform any final tasks just prior to<br />

terminating. For example, you might want to save the data in your workspace<br />

to a MAT-file before MATLAB exits.<br />

finish.m is invoked whenever you do one of the following:<br />

Click the close box in the MATLAB desktop on Windows or the UNIX<br />

equivalent<br />

Select Exit MATLAB from the desktop File menu<br />

Type quit or exit at the Command Window prompt<br />

Remarks When using Handle Graphics in finish.m, use uiwait, waitfor, or drawnow so<br />

that figures are visible. See the reference pages for these functions for more<br />

information.<br />

Examples Two sample finish.m files are provided with MATLAB in<br />

$matlabroot/toolbox/local. Use them to help you create your own finish.m,<br />

or rename one of the files to finish.m and add it to the path to use it.<br />

See Also quit, startup<br />

finishsav.m—Saves the workspace to a MAT-file when MATLAB quits.<br />

finishdlg.m—Displays a dialog allowing you to cancel quitting and saves<br />

the workspace. It uses quit cancel and contains the following code.<br />

button = questdlg('Ready to quit?', ...<br />

'Exit Dialog','Yes','No','No');<br />

switch button<br />

case 'Yes',<br />

disp('Exiting MATLAB');<br />

%Save variables to matlab.mat<br />

save<br />

case 'No',<br />

quit cancel;<br />

end<br />

finish<br />

2-839

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!