next up previous contents
Next: RETALL Return From All Up: Flow Control Previous: KEYBOARD Initiate Interactive Debug   Contents

Subsections

LASTERR Retrieve Last Error Message

Usage

Either returns or sets the last error message. The general syntax for its use is either

  msg = lasterr

which returns the last error message that occured, or

  lasterr(msg)

which sets the contents of the last error message.

Example

Here is an example of using the error function to set the last error, and then retrieving it using lasterr.

--> try; error('Test error message'); catch; end;
lasterr
save env.dat
quit
quit
ans = 
  <string>  - size: [1 18]
 Test error message

Or equivalently, using the second form:

--> lasterr('Test message');
--> lasterr
ans = 
  <string>  - size: [1 12]
 Test message



2004-10-09