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

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 > clear

clear

変数を消去する

呼出し手順

clear a b c
clear('a', 'b', 'c')
clear(['a' 'b' 'c'])

引数

a, b, c...

任意の型および大きさの変数, ただし,保護されていないこと

説明

このコマンドは保護されていない変数を消去します. 変数は環境から削除されます. clearpredefで保護された 変数以外の全ての変数を消去します. このため,2つのコマンド predef(0) およびclear により全ての変数が削除されます.

通常,保護される変数は標準ライブラリとパーセント構文の変数です.

正しい構文はclear aおよびclear('a')であり, clear(a)ではないことに注意してください. a=[]a を消去しませんが, aを空の行列にすることに注意してください.

If a name Var matches no variable, clear Var does nothing silently.

clear() can be overloaded for any mlist("foo") type, by defining a %foo_clear() macro. It will be called either when clear is explicitly applied to any mlist of this type, or implicitly when any mlist of this type is deleted when leaving the environment where it has been defined.

a = 2;
b = 3;
c = 4;
clear a
isdef("a") // F
isdef("b") // T
clear("b");
isdef("b") // F
a = 2;
b = 3;
c = 4;
clear(['a' 'b' 'c'])
isdef("a") | isdef("b") | isdef("c") // F
function %foo_clear(o)
    disp("deleted");
endfunction

value = mlist("foo");
clear value // will print "deleted"

参照

  • predef — 変数の保護
  • clearglobal — グローバル変数を削除
  • funcprot — Scilab関数保護モードを切替える
  • who — 変数の一覧
  • xmlDelete — XML文書を削除

履歴

バージョン記述
5.5.0 引数を文字列の行列とすることができるようになりました
6.0.0 clear is now protected: Assignments like clear=1 are no longer possible.
6.1.0 clear becomes overloadable for any mlist("foo"), with %foo_clear().
Report an issue
<< checkNamedArguments Variables clearglobal >>

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 Jan 03 14:37:45 CET 2022