Main Content

Ausnahmenbehandlung

Erfassen von Daten zu Fehlern

Jeder MATLAB®-Code, der einen Fehler erfasst und eine Ausnahme ausgibt, konstruiert ein MException-Objekt. MATLAB kann entweder vordefinierte Ausnahmen oder von Ihnen erstellte Ausnahmen ausgeben.

Funktionen

try, catchAusführen von Anweisungen und Erfassen der resultierenden Fehler
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 (Seit R2019b)
matlab.lang.correction.ReplaceIdentifierCorrectionCorrect error by replacing identifier in function call (Seit R2019b)

Themen