8.8. Errors and Warnings

In many cases, it is desirable to take specific actions when different kinds of errors occur. For example, one may want to prompt the user for more input, display extended error or warning information, or repeat a calculation using default values. Error-handling capabilities of MATLAB allow checking of particular error conditions and execute appropriate program depending on the situation.

8.8.1. Types of Errors

There are basically two types of errors:

  • Syntax errors

  • Runtime errors

Syntax errors are caused by grammatical mistakes in the statement included in the program i.e. using or not using comma, semicolon, bracket or parenthesis. It may be caused by misspelling a function name or using wrong array indices and so on. ...

Get MATLAB® and Its Applications in Engineering: [Based on MATLAB 7.5 (R2007b)] now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.