getReport (MException) - Get error message for exception

Syntax

Report = getReport(ME)

Description

Report = getReport(ME) returns a formatted message string based on the current exception (represented by MException object ME) and that uses the same format as errors thrown by internal MATLAB® code. The message string returned by getReport is the same as the error message displayed by MATLAB when it throws the exception.

Examples

Using the surf command without input arguments throws an exception. The catch function captures the exception in MException object ME. Use getReport to obtain the error text in the same format that MATLAB uses:

try
   surf
catch ME
   getReport(ME)
end

ans =
   ??? Error using ==> surf at 54
   Not enough input arguments.

See Also

try, catch, error, assert, MException, disp(MException), throw(MException), rethrow(MException), throwAsCaller(MException), addCause(MException), isequal(MException), eq(MException), ne(MException), last(MException),

  


 © 1984-2008- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS