Scilab Website | Contribute with GitLab | Mailing list archives | ATOMS toolboxes
Scilab Online Help
6.1.0 - 日本語

Change language to:
English - Français - Português - Русский

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

Scilabヘルプ >> Scilab > Variables > exists

exists

変数の存在を確認する

呼出し手順

ve = exists(name [,where])

引数

ve

nameと同じ大きさの行列で, 使用される値は: 1 (trueの場合), 0 (falseの場合)

name

文字列の行列

where

オプションの文字で,以下の値を指定します: 'l' (local), 'n' (nolocal) および 'a' (all). デフォルト値は'a'です.

説明

exists(name) は, nameという名前の変数が存在する場合に 1,それ以外の場合に0を返します.   

注意: exists を使用する関数は, 環境に依存する結果を返す可能性があります!

exists(name,'l') は, nameという名前の変数がカレントの関数の 環境に存在する場合に 1, それ以外の場合に 0 を返します.

exists(name,'n') は, nameという名前の変数が関数の呼び出し元の 環境(Scilabシェルメインレベルを含む)に存在する場合に 1, それ以外の場合に 0 を返します.

警告: exists関数は,ある変数が グローバル 名前空間に存在するかどうかを確認しません.

exists("myNotLikelyToExistVar")
myNotLikelyToExistVar = 1;
exists("myNotLikelyToExistVar")
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","b"],"a"));
    disp(exists(["a","b"],"l"));
    disp(exists(["a","b"],"n"));
  endfunction
  level2()
endfunction
function go()
  a=1;
  level1()
endfunction
go()

参照

  • isdef — 変数の存在を確認
  • isglobal — checks if a local variable has a global counterpart
  • whereis — Returns the name of the loaded library/module a given function belongs to
  • type — 変数の型を返す
  • typeof — explicit type or overloading code of an object
  • macrovar — 関数の変数
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:
Tue Feb 25 08:53:18 CET 2020