Get last recorded error message (original) (raw)
Scilab 5.3.3
- Scilab help
- Scilab
- Scilab keywords
- TMPDIR
- abort
- add_demo
- argn
- banner
- boolean
- break
- clear
- clearfun
- clearglobal
- comp
- continue
- debug
- delbpt
- dispbpt
- edit
- errcatch
- errclear
- error
- error_table
- exists
- exit
- external
- extraction
- format
- funcprot
- funptr
- getdebuginfo
- getmd5
- getmemory
- getmodules
- getos
- getscilabmode
- getshell
- getvariablesonstack
- getversion
- gstacksize
- ieee
- insertion
- intppty
- inv_coeff
- iserror
- isglobal
- lasterror
- macr2lst
- macr2tree
- matrices
- matrix
- mode
- mtlb_mode
- names
- newfun
- null
- pause
- perl
- poly
- predef
- quit
- rational
- readgateway
- resume
- sciargs
- scilab
- setbpt
- stacksize
- startup
- symbols
- testmatrix
- type
- typename
- user
- varn
- ver
- warning
- what
- where
- whereami
- who
- who_user
- whos
- with_atlas
- with_javasci
- with_macros_source
- with_module
- with_pvm
- with_texmacs
- with_tk
Please note that the recommended version of Scilab is 2026.0.1. This page might be outdated.
See the recommended documentation of this function
Scilab help >> Scilab > lasterror
lasterror
get last recorded error message
Calling Sequence
str=lasterror( [opt] ) [str,n]=lasterror([opt]) [str,n,line,func]=lasterror([opt])
Arguments
str
vector of character strings or an empty matrix. The last recorded error message.
n
integer, 0 or the last recorded error number.
line
integer, 0 or the last recorded function line number.
func
string, the last recorded function name
opt
boolean, if %t recorded message is cleared. Default is %t.
Description
Each time an error occurs, the Scilab error handler records it in an internal table (only the last one is retained). Thelasterror 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 tolasterror usinglasterror(%f).
Examples
ierr=execstr('a=zzzzzzz','errcatch') if ierr>0 then disp(lasterror()),end
See Also
- errcatch — error trapping
- execstr — execute Scilab code in strings
- error — error messages
- errclear — error clearing
- edit_error — opens in scilab editor the source of the last recorded error