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

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 help >> Scilab > exists

exists

変数の存在を確認する

呼出し手順

exists(name [,where])

パラメータ

name

文字列

where

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

説明

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

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

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

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

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

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()

参照

  • isdef — 変数の存在を確認
  • isglobal — 変数がグローバルかどうかを確認
  • whereis — 関数が属するライブラリの名前
  • type — 変数の型を返す
  • typeof — オブジェクトの型
  • macrovar — 関数の変数
<< error_table Scilab exit >>

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:
Wed Oct 05 12:12:31 CEST 2011