Quitting the MATLAB® Program

Ways to Quit the MATLAB® Program

To quit the MATLAB® program at any time, do one of the following:

MATLAB closes after

Confirm Quitting the MATLAB® Program

To set a preference that displays a confirmation dialog box when you quit MATLAB, select File > Preferences > General > Confirmation Dialogs, select the Confirm before quitting check box, and click OK. MATLAB then displays the following dialog box when you quit.

Image of Exit confirmation dialog box .

For more information, see Confirmation Dialogs Preferences.

You can also display your own quitting confirmation dialog box using a finish.m script, as described in the following section.

Running a Script When Quitting the MATLAB® Program

When MATLAB quits, it runs the script finish.m, if finish.m exists in the current directory or anywhere on the search path. You create the file finish.m. It contains statements to run when MATLAB terminates, such as saving the workspace or displaying a confirmation dialog box. There are two sample files in matlabroot/toolbox/local that you can use as the basis for your own finish.m file:

For more information, see the finish reference page.

Abnormal Termination

When the MATLAB® Program Terminates Unexpectedly

In the event MATLAB experiences a segmentation violation (segv) or other serious problem, the MATLAB System Error dialog box opens to notify you about the problem. When this occurs, the internal state of MATLAB is unreliable and not suitable for further use. You should exit as soon as possible and then restart. However, you might want to first try to save your work in progress.

To exit and restart without trying to save your work, follow these steps:

  1. If you want to view the stack trace for the problem, click Details.

  2. Click Close to terminate MATLAB.

  3. Restart MATLAB. If the Error Log Reporter dialog box opens, send a report to The MathWorks.

To try to save your work in progress before exiting and restarting MATLAB, follow these steps:

  1. If you want to view the stack trace for the problem, click Details.

  2. Click Attempt to Continue. MATLAB tries to return to the Command Window or tool you were using.

    The Command Window displays the message Please exit and restart MATLAB to the left of the prompt, which reminds you to discontinue use.

  3. From the Command Window or tool, try to save the workspace and unsaved files.

  4. Exit MATLAB immediately after saving because any further usage would be unreliable.

  5. Restart MATLAB. If the Error Log Reporter dialog box opens, send a report to The MathWorks.

Error Log Reporting

Upon startup, if MATLAB detects an error log generated by a serious problem during the previous session, an Error Log Reporter prompts you to e-mail the log to The MathWorks for analysis. The error log contains the stack trace and information about the MATLAB configuration. If the problem occurs repeatedly, make note of what seems to cause it, look for information about it in the MathWorks Bug Reports database, and if the problem is reproducible, please submit a Service Request via http://www.mathworks.com/support/contact_us/ts/help_request_1.html.

E-Mailing Error Log Reports.   There are some situations where the Error Log Reporter will not open, for example, when you start MATLAB with a -r option or run in deployed mode. It also will not open if you selected the option to never send error reports the last time the Error Log Reporter opened. If you experience abnormal termination but do not see the Error Log Reporter on subsequent startups, you can instead e-mail the reports.

Send e-mail to segv@mathworks.com with this file attached: C:\Temp\matlab_crash_dump.####. After you send the log file, delete it or move it to another location. If you do not delete the log file, the Error Log Reporter can detect it on the next startup and prompt you to send it, even though you already e-mailed it.

Recovering Data After an Abnormal Termination

If MATLAB terminates unexpectedly, you might lose information. After you start MATLAB again, you can try these suggestions to recover some of the information.

Some of the above suggestions refer to actions you might have needed to take during the session when MATLAB terminated. If you did not take those actions, consider regularly performing them to help you recover from any future abnormal terminations you might experience.

  


 © 1984-2008- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS