Main Content

Advanced Evaluation and Exception Handling

Evaluate expressions, capture data on errors

MATLAB® includes functionality to indirectly evaluate expressions and to collect data about errors.

Any MATLAB code that detects an error and throws an exception constructs an MException object. MATLAB can throw either predefined exceptions or exceptions that you construct.

Functions

expand all

evalEvaluate MATLAB expression
evalcEvaluate MATLAB expression and capture results
evalinEvaluate MATLAB expression in specified workspace
try, catchExecute statements and catch resulting errors
MExceptionCapture error information
addCauseRecord additional causes of exception
addCorrectionProvide suggested fix for exception
getReportGet error message for exception
MException.lastReturn last uncaught exception
rethrowRethrow previously caught exception
throwThrow exception
throwAsCallerThrow exception as if occurs within calling function
matlab.lang.correction.AppendArgumentsCorrectionCorrect error by appending missing input arguments
matlab.lang.correction.ConvertToFunctionNotationCorrectionCorrect error by converting to function notation
matlab.lang.correction.ReplaceIdentifierCorrectionCorrect error by replacing identifier in function call

Topics