Using a function to create a global variable in the workspace

1 次查看(过去 30 天)
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.

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Variables 的更多信息

产品

Community Treasure Hunt

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

Start Hunting!

Translated by