| Programming | ![]() |
Nested try-catch Blocks
You can also nest try-catch blocks, as shown here. You can use this to attempt to recover from an error caught in the first try section.
trystatement1% Try to execute statement1 catch trystatement2% Attempt to recover from error catch disp 'Operation failed' % Handle the error end end
| Checking for Errors with try-catch | Handling and Recovering from an Error | ![]() |
© 1994-2005 The MathWorks, Inc.