Documentation Center

  • 評価版
  • 製品アップデート

getlasterror

Retrieve the last error number and text

Use only in the MuPAD Notebook Interface.

This functionality does not run in MATLAB.

Syntax

getlasterror()

Description

getlasterror() returns the last error that occurred in the current MuPAD® session, as a list of the error number and the error string.

After an error has occurred (whether visible or caught by traperror), getlasterror will return both the error number (as returned by traperror) and the error string.

In a MuPAD session where no errors occurred, getlasterror returns the list [0, ""]. This is also true after a call to reset().

    Note:   Note that the MuPAD library uses traperror itself and that getlasterror() may return errors that have been caught and properly handled by the library already. You should not use getlasterror to detect errors, use the return value of traperror instead!

Examples

Example 1

In a fresh session, getlasterror returns a list indicating "no errors yet":

getlasterror()

After an error has been thrown, getlasterror returns the corresponding number and string:

ln(0)
Error: Singularity. [ln]
getlasterror()

This includes errors not displayed because of traperror:

traperror(solve(a, b, c))

getlasterror()

Return Values

List of an integer and a string

See Also

MuPAD Functions

Was this topic helpful?