<?xml version="1.0" encoding="ISO-8859-1" standalone="no"?>
<!DOCTYPE MAN SYSTEM "../../manrev.dtd">
<MAN>
  <LANGUAGE>eng</LANGUAGE>
  <TITLE>lasterror</TITLE>
  <TYPE>Scilab Function</TYPE>
  <DATE>April 2000</DATE>
  <SHORT_DESCRIPTION name="lasterror"> get last recorded error message</SHORT_DESCRIPTION>
  <CALLING_SEQUENCE>
    <CALLING_SEQUENCE_ITEM>str=lasterror( [opt] )  </CALLING_SEQUENCE_ITEM>
    <CALLING_SEQUENCE_ITEM>[str,n]=lasterror([opt])  </CALLING_SEQUENCE_ITEM>
    <CALLING_SEQUENCE_ITEM>[str,n,line,func]=lasterror([opt])  </CALLING_SEQUENCE_ITEM>
  </CALLING_SEQUENCE>
  <PARAM>
    <PARAM_INDENT>
      <PARAM_ITEM>
        <PARAM_NAME>str</PARAM_NAME>
        <PARAM_DESCRIPTION>
          <SP>:  vector of character strings or an empty matrix. The last recorded error message.</SP>
        </PARAM_DESCRIPTION>
      </PARAM_ITEM>
      <PARAM_ITEM>
        <PARAM_NAME>n</PARAM_NAME>
        <PARAM_DESCRIPTION>
          <SP>:  integer, 0 or the last recorded error number.</SP>
        </PARAM_DESCRIPTION>
      </PARAM_ITEM>
      <PARAM_ITEM>
        <PARAM_NAME>line</PARAM_NAME>
        <PARAM_DESCRIPTION>
          <SP>:  integer, 0 or the last recorded function line number.</SP>
        </PARAM_DESCRIPTION>
      </PARAM_ITEM>
      <PARAM_ITEM>
        <PARAM_NAME>func</PARAM_NAME>
        <PARAM_DESCRIPTION>
          <SP>:  string,the last recorded function name</SP>
        </PARAM_DESCRIPTION>
      </PARAM_ITEM>
      <PARAM_ITEM>
        <PARAM_NAME>opt</PARAM_NAME>
        <PARAM_DESCRIPTION>
          <SP>:  boolean, if %t recorded message is cleared. Default is %t.</SP>
        </PARAM_DESCRIPTION>
      </PARAM_ITEM>
    </PARAM_INDENT>
  </PARAM>
  <DESCRIPTION>
    <P>
    Each time an error occur, the Scilab error handler records it in
    internal tables (only the last one is retained). The <VERB>lasterror</VERB>
    function allows to get the message,  the error number, the current
    function (if any) and the current line of the current function out of these
    tables.</P>
    <P>
    This function is useful while using <VERB>errcatch</VERB> or <VERB>execstr</VERB>.</P>
    <P>
    The recorded error message may be retained for a further call to
    <VERB>lasterror</VERB> using <VERB>lasterror(%f)</VERB>.</P>
  </DESCRIPTION>
  <EXAMPLE>
<![CDATA[
ierr=execstr('a=zzzzzzz','errcatch')
if ierr>0 then disp(lasterror()),end
 ]]>
  </EXAMPLE>
  <SEE_ALSO>
    <SEE_ALSO_ITEM>
      <LINK>errcatch</LINK>
    </SEE_ALSO_ITEM>
    <SEE_ALSO_ITEM>
      <LINK>execstr</LINK>
    </SEE_ALSO_ITEM>
    <SEE_ALSO_ITEM>
      <LINK>error</LINK>
    </SEE_ALSO_ITEM>
    <SEE_ALSO_ITEM>
      <LINK>errclear</LINK>
    </SEE_ALSO_ITEM>
    <SEE_ALSO_ITEM>
      <LINK>edit_error</LINK>
    </SEE_ALSO_ITEM>
   </SEE_ALSO>
</MAN>
