Skip to content

lasterror

Information about the last error encountered.

s = lasterror
lasterror('reset')

Returns a structure describing the last error — fields include message, identifier, and stack. With 'reset', clears the stored last-error info.

Note: superseded by try/catch ME blocks where ME directly captures the exception. Retained for compatibility.

s = lasterror; disp(s.message)