\section{LASTERR Retrieve Last Error Message}

\subsection{Usage}

Either returns or sets the last error message.  The
general syntax for its use is either
\begin{verbatim}
  msg = lasterr
\end{verbatim}
which returns the last error message that occured, or
\begin{verbatim}
  lasterr(msg)
\end{verbatim}
which sets the contents of the last error message.
\subsection{Example}

Here is an example of using the \verb|error| function to
set the last error, and then retrieving it using
lasterr.
\begin{verbatim}
--> try; error('Test error message'); catch; end;
--> lasterr
ans = 
  <string>  - size: [1 18]
 Test error message

\end{verbatim}
Or equivalently, using the second form:
\begin{verbatim}
--> lasterr('Test message');
--> lasterr
ans = 
  <string>  - size: [1 12]
 Test message

\end{verbatim}
