Scilab Website | Contribute with GitLab | Mailing list archives | ATOMS toolboxes
Scilab Online Help
2023.1.0 - Português


exists

verifica existência de variáveis

Seqüência de Chamamento

ve = exists(name)
ve = exists(name, where)

Parâmetros

name

matrix of character strings: names of queried variables.

where

um caractere opcional com possíveis valores: 'l' (local), 'n' (nolocal) and 'a' (all). O valor padrão é 'all'.

ve

a matrix with the same size as name with possible values: 1 if true, 0 if false

Descrição

exists(name) retorna 1 se a variável chamada name existe e 0, em caso contrário.

Aviso: uma função que utiliza exists pode retornar um resultado que depende do ambiente!

exists(name,'l') retorna 1 se a variável chamada name existe no ambiente local da função corrente e 0 , em caso contrário.

exists(name,'n') retorna 1 se a variável chamada name existe em qualquer nível do ambiente de chamamento (incluindo o nível principal do shell do Scilab) da função corrente e 0 , em caso contrário.

Aviso: a função exists não verifica se a variável existe no espaço de nomes global.

Exemplos

deff('foo(x)',..
['disp([exists(''a12''),exists(''a12'',''l'')])'
 'disp([exists(''x''),exists(''x'',''l'')])'])
foo(1)
a12=[];foo(1)

function level1()
  function level2()
    disp(exists("a","a"));
    disp(exists("a","l"));
    disp(exists("a","n"));
  endfunction
  level2()
endfunction
function go()
  a=1;
  level1()
endfunction
go()
Report an issue
<< clearglobal Variables global >>

Copyright (c) 2022-2023 (Dassault Systèmes)
Copyright (c) 2017-2022 (ESI Group)
Copyright (c) 2011-2017 (Scilab Enterprises)
Copyright (c) 1989-2012 (INRIA)
Copyright (c) 1989-2007 (ENPC)
with contributors
Last updated:
Mon May 22 12:42:11 CEST 2023