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


isdef

変数の存在を確認

呼び出し手順

ve = isdef(name)
ve = isdef(name, where)

引数

ve

論理値を有する nameと同じ大きさの行列

name

文字列の行列

where

文字列, 'l' ("local"の場合), 'n' ("nolocal"の場合) or 'a' ("all"の場合)を指定できます. デフォルト値は 'a'です.

説明

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

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

isdef(name, 'l') は, name という名前の変数がカレントの関数のローカル環境に 存在する場合に%T, それ以外の場合に %F を返します.

isdef(name, 'n') は, name という名前の変数が (グローバルレベルを含む)呼び出した側の環境に 存在する場合に%T, それ以外の場合に %Fを返します.

注意: whereオプション の最初の1文字のみが処理されます.

A = 1; B = 2; C = 3; D = 4;
isdef(['A', 'B'; 'C', 'D'])
clear A B C D;
isdef(['A', 'B'; 'C', 'D'])
function level1()
  function level2()
    disp(isdef(["a", "b"], "a"));
    disp(isdef(["a", "b"], "l"));
    disp(isdef(["a", "b"], "n"));
  endfunction
  level2()
endfunction
function go()
  a = 1;
  level1()
endfunction
go()

参照

  • exists — 変数の存在を確認する
  • 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
  • clear — 変数を消去する
Report an issue
<< global Variables isglobal >>

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 Mar 07 09:28:39 CET 2023