当我关闭matlab时候,会出现一个提示“是否关闭”的对话框。
首先在command窗口下:edit quit.m,下面是帮助文件:
%QUIT Quit MATLAB session.
% QUIT terminates MATLAB after running the script FINISH.M,
% if it exists. The workspace information will not be saved
% unless FINISH.M calls SAVE. If an error occurs while
% executing FINISH.M, quitting is cancelled.
%
% QUIT FORCE can be used to bypass an errant FINISH.M that
% will not let you quit.
%
% QUIT CANCEL can be used in FINISH.M to cancel quitting.
% It has no effect anywhere else.
%
% Example
% Put the following lines of code in your FINISH.M file to
% display a dialog that allows you to cancel quitting.
%
% button = questdlg('Ready to quit?', ...
% 'Exit Dialog','Yes','No','No');
% switch button
% case 'Yes',
% disp('Exiting MATLAB');
% %Save variables to matlab.mat
% save
% case 'No',
% quit cancel;
% end
将上面红色的文字新建一个finish.m放在matlab可搜索路径下,即可: