フィルターのクリア

Static variables in MATLAB

155 ビュー (過去 30 日間)
Anirudh Sharma
Anirudh Sharma 2016 年 10 月 6 日
コメント済み: Ravi Singh 2020 年 4 月 23 日
How do I declare static variable in MATLAB?

採用された回答

Abhishek Jain
Abhishek Jain 2016 年 10 月 6 日
編集済み: madhan ravi 2018 年 11 月 11 日
Use keyword persistent to declare static variables
persistent x;

その他の回答 (1 件)

Adam
Adam 2016 年 10 月 6 日
You can use persistent variables if that is what you mean, but only use them if you really need to. Similar to global variables they are far easier to introduce bugs into your workspace with then simply passing variables around between functions or using a class to define the scope of a variable.
  1 件のコメント
Ravi Singh
Ravi Singh 2020 年 4 月 23 日
Hi Adam ,
I need to assign a static variable in one method call and use the same variable in another method call is there any way to do so ?

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeEntering Commands についてさらに検索

タグ

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by