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, catch | Eseguire le dichiarazioni e catturare gli errori risultanti |
MException | Capture error information |
addCause | Record additional causes of exception |
addCorrection | Provide suggested fix for exception |
getReport | Get error message for exception |
MException.last | Return last uncaught exception |
rethrow | Rethrow previously caught exception |
throw | Throw exception |
throwAsCaller | Throw exception as if occurs within calling function |
matlab.lang.correction.AppendArgumentsCorrection | Correct error by appending missing input arguments |
matlab.lang.correction.ConvertToFunctionNotationCorrection | Correct error by converting to function notation |
matlab.lang.correction.ReplaceIdentifierCorrection | Correct error by replacing identifier in function call |
Argomenti
- Exception Handling in a MATLAB Application
It is a good programming practice to include error checking in your programs to ensure reliable operation under all conditions. You can decide how your programs respond to different types of errors.