MATLAB Programming

MATLAB Programming MATLAB Programming

cda.psych.uiuc.edu
from cda.psych.uiuc.edu More from this publisher
23.06.2015 Views

7 Working with Scientific Data Formats 7-72

8 Error Handling In many cases, it is desirable to take specific actions when different kinds of errors occur. For example, you may want to prompt the user for more input, display extended error or warning information, or repeat a calculation using default values. The error handling capabilities in MATLAB let your application check for particular error conditions and execute appropriate code depending on the situation. Checking for Errors with try-catch (p. 8-2) Handling and Recovering from an Error (p. 8-4) Message Identifiers (p. 8-10) Warnings (p. 8-14) Warning Control (p. 8-16) Debugging Errors and Warnings (p. 8-26) Checking for errors that occur in your programs using the try and catch functions Reporting errors and identifying what caused them; regenerating errors Attaching an identifier to an error or warning to enable you to better identify what caused it, and also for selective warning control Identifying warnings and identifying what caused them Controlling the action taken when a warning is encountered Stopping code execution in the debugger on the occurrence of an errororwarnings

8<br />

Error Handling<br />

In many cases, it is desirable to take specific actions when different kinds<br />

of errors occur. For example, you may want to prompt the user for more<br />

input, display extended error or warning information, or repeat a calculation<br />

using default values. The error handling capabilities in <strong>MATLAB</strong> let your<br />

application check for particular error conditions and execute appropriate code<br />

depending on the situation.<br />

Checking for Errors with try-catch<br />

(p. 8-2)<br />

Handling and Recovering from an<br />

Error (p. 8-4)<br />

Message Identifiers (p. 8-10)<br />

Warnings (p. 8-14)<br />

Warning Control (p. 8-16)<br />

Debugging Errors and Warnings<br />

(p. 8-26)<br />

Checking for errors that occur in<br />

your programs using the try and<br />

catch functions<br />

Reporting errors and identifying<br />

what caused them; regenerating<br />

errors<br />

Attaching an identifier to an error<br />

or warning to enable you to better<br />

identify what caused it, and also for<br />

selective warning control<br />

Identifying warnings and identifying<br />

what caused them<br />

Controlling the action taken when a<br />

warning is encountered<br />

Stopping code execution in the<br />

debugger on the occurrence of an<br />

errororwarnings

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

Saved successfully!

Ooh no, something went wrong!