Error Handling

Generate warnings and errors, capture data on cause of error


MuPAD® notebooks will be removed in a future release. Use MATLAB® live scripts instead.

To convert a MuPAD notebook file to a MATLAB live script file, see convertMuPADNotebook. MATLAB live scripts support most MuPAD functionality, although there are some differences. For more information, see Convert MuPAD Notebooks to MATLAB Live Scripts.

MuPAD Functions

errorRaise a user-specified exception
getlasterrorRetrieve the last error number and text
lasterrorReproduce the last error
traperrorTrap errors
warningPrint a warning message


Write Error and Warning Messages

When writing a procedure in MuPAD, you can include error and warning messages in your procedure.

Handle Errors

Typically, when a MuPAD procedure encounters an error caused by evaluation of an object, the procedure terminates, the system returns to an interactive level and displays an error message.