| Products & Services | Solutions | Academia | Support | User Community | Company |
| Download Product Updates | | | Get Pricing | | | Trial Software |
| Documentation → MATLAB |
| Contents | Index |
| Learn more about MATLAB |
errRecord = MException.last
MException.last('reset')
errRecord = MException.last displays the contents of the MException object representing your most recent uncaught error. This is a static method of the MException class; it is not a method of an MException class object. Use this method from the MATLAB command line only, and not within an M-file.
MException.last('reset') sets the identifier and message properties of the most recent exception to the empty string, the stack property to a 0-by-1 structure, and cause property to an empty cell array.
last is not set in a try-catch statement.
This example displays the last error that was caught during this MATLAB session:
A = 25;
A(2)
??? Index exceeds matrix dimensions.
MException.last
ans =
MException object with properties:
identifier: 'MATLAB:badsubscript'
message: 'Index exceeds matrix dimensions.'
stack: [0x1 struct]
cause: {}try, catch, error, assert, MException, throw(MException), rethrow(MException), throwAsCaller(MException), addCause(MException), getReport(MException),
![]() | kron | lastDirectory (Tiff) | ![]() |

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.
| © 1984-2009- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |