Scilab Home page | Wiki | Bug tracker | Forge | Mailing list archives | ATOMS | File exchange
Please login or create an account
Change language to: English - Português - 日本語

Please note that the recommended version of Scilab is 6.1.1. This page might be outdated.
See the recommended documentation of this function

Aide Scilab >> Scilab > lasterror


get last recorded error message

Calling Sequence

str=lasterror( [opt] )



vector of character strings or an empty matrix. The last recorded error message.


integer, 0 or the last recorded error number.


integer, 0 or the last recorded function line number.


string, the last recorded function name


boolean, if %t recorded message is cleared. Default is %t.


Each time an error occurs, the Scilab error handler records it in an internal table (only the last one is retained). The lasterror function allows to get the message, the error number, the current function (if any) and the current line number in the current function out of this table.

The reported line number is the physical line number where the last error occurred. Note that Scilab versions before 5.0 used to report the logical line number of the last error. There is a difference only if the function in error includes continued lines (see dot) before the point where the error happened.

This function is especially useful while using errcatch or execstr.

The recorded error message may be retained for a further call to lasterror using lasterror(%f).


if ierr>0 then disp(lasterror()),end

See Also

  • errcatch — interception d'erreur
  • execstr — exécution d'instructions Scilab contenues dans des chaînes de caractères
  • error — envoi de message d'erreur
  • errclear — "effacement" d'une erreur
  • edit_error — opens in scilab editor the source of the last recorded error
Scilab Enterprises
Copyright (c) 2011-2017 (Scilab Enterprises)
Copyright (c) 1989-2012 (INRIA)
Copyright (c) 1989-2007 (ENPC)
with contributors
Last updated:
Thu May 12 11:44:46 CEST 2011