MATLAB Function Reference Previous page   Next Page
try

Attempt to execute block of code, and catch errors

Description

The general form of a try statement is

Normally, only the statements between the try and catch are executed. However, if an error occurs during execution of any of the statements, the error is captured into lasterr, and the statements between the catch and end are executed. If an error occurs within the catch statements, execution stops unless caught by another try...catch block. The error string produced by a failed try block can be obtained with lasterr.

See Also

catch, end, lasterr, eval, evalin


Previous page  true tsearch Next page

© 1994-2005 The MathWorks, Inc.