フィルターのクリア

How to create global variables in a GUI m-file

1 回表示 (過去 30 日間)
Digitalsd
Digitalsd 2012 年 12 月 30 日
To simplify the question, I will suppose a GUI including two buttons; button1 and button2. During the running of button1 callback the m code creates variables; some of these variables will be needed during the button2 callback. The question is: Can I create and set up global variables in a GUI m-file which could be used in all internal functions ?

採用された回答

Image Analyst
Image Analyst 2012 年 12 月 30 日
Place a line like
global myVariable1;
in every function that needs to see the variable. Functions without that line won't be able to see the variable.

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeEnvironment and Settings についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by