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.
There are basically two types of 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. ...