Using a function to create a global variable in the workspace

1 vue (au cours des 30 derniers jours)
Paulo Silva
Paulo Silva le 22 Mar 2011
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.

Réponse acceptée

Walter Roberson
Walter Roberson le 22 Mar 2011
evalin(caller, 'global foo; foo=12345;');
  3 commentaires
Walter Roberson
Walter Roberson le 22 Mar 2011
I have not seen any reference to such a method. Global variables are considered to exist in a different workspace.
Paulo Silva
Paulo Silva le 22 Mar 2011
ok Walter thanks again :)

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Variables dans Help Center et File Exchange

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by