Using a function to create a global variable in the workspace

1 回表示 (過去 30 日間)
Paulo Silva
Paulo Silva 2011 年 3 月 22 日
I'm making a GUI to replace one m file, the m file creates several variables in the workspace and now I want to do the same in the GUI, some of the variables need to have global in their attributes, how can I use assignin or set the attribute in order to have global variables?
Thanks in advance and sorry for such a basic question, I searched before asking but didn't found the answer.

採用された回答

Walter Roberson
Walter Roberson 2011 年 3 月 22 日
evalin(caller, 'global foo; foo=12345;');
  3 件のコメント
Walter Roberson
Walter Roberson 2011 年 3 月 22 日
I have not seen any reference to such a method. Global variables are considered to exist in a different workspace.
Paulo Silva
Paulo Silva 2011 年 3 月 22 日
ok Walter thanks again :)

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

その他の回答 (0 件)

カテゴリ

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

製品

Community Treasure Hunt

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

Start Hunting!

Translated by