Main Content

Gestione delle eccezioni

Acquisire dati sugli errori

Qualsiasi codice MATLAB® che rileva un errore e lancia un'eccezione costruisce un oggetto MException. Il codice MATLAB può lanciare eccezioni predefinite o eccezioni costruite dall'utente.

Funzioni

try, catchEseguire le dichiarazioni e catturare gli errori risultanti
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 (Da R2019b)
matlab.lang.correction.ReplaceIdentifierCorrectionCorrect error by replacing identifier in function call (Da R2019b)

Argomenti