- Scilab Online 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 2025.0.0. This page might be outdated.
See the recommended documentation of this function
exists
checks variable existence
Calling Sequence
exists(name [,where])
Arguments
- name
a character string
- where
an optional character with possible values:
'l'
(local),'n'
(nolocal) and'a'
(all). The default value is'all'.
Description
exists(name)
returns 1
if the
variable named name
exists and 0
otherwise.
Caveats: a function which uses exists
may return
a result which depends on the environment!
exists(name,'local')
returns 1
if the variable named name
exists in the environment of
the current function and 0
otherwise.
exists(name,'nolocal')
returns
1
if the variable named name
exists
in any level of the calling environment (including the Scilab shell main level) of the current function and
0
otherwise.
Warning: the exists function does not check if a variable exists in the global namespace.
Examples
deff('foo(x)',.. ['disp([exists(''a12''),exists(''a12'',''local'')])' 'disp([exists(''x''),exists(''x'',''local'')])']) foo(1) a12=[];foo(1) function level1() function level2() disp(exists("a","all")); disp(exists("a","local")); disp(exists("a","nolocal")); endfunction level2() endfunction function go() a=1; level1() endfunction go()
<< error_table | Scilab | exit >> |