Function Reference
— Built-in Function: err = lasterror (err)
— Built-in Function: lasterror ('reset')

Returns or sets the last error message. Called without any arguments returns a structure containing the last error message, as well as other information related to this error. The elements of this structure are:

'message'
The text of the last error message
'identifier'
The message identifier of this error message
'stack'
A structure containing information on where the message occurred. This might be an empty structure if this in the case where this information can not be obtained. The fields of this structure are:
'file'
The name of the file where the error occurred
'name'
The name of function in which the error occurred
'line'
The line number at which the error occurred
'column'
An optional field with the column number at which the error occurred

The err structure may also be passed to lasterror to set the information about the last error. The only constraint on err in that case is that it is a scalar structure. Any fields of err that match the above are set to the value passed in err, while other fields are set to their default values.

If lasterror is called with the argument 'reset', all values take their default values.