it is possible to access the 'base' workspace from a subfonction ?

6 vues (au cours des 30 derniers jours)
tayeb
tayeb le 17 Juil 2012
I'm would like to access some variables in the 'base' workspace from a subfonction. because when I tried the variables is not found.
thanks in advance ;)

Réponse acceptée

Daniel Shub
Daniel Shub le 17 Juil 2012
Yes if is possible to manipulate and access the base workspace from within a function. Just because MATLAB provides this functionality, however, doesn't mean it is a good idea to use it. Please consider alternatives.
The functions you are looking for are EVALIN and ASSIGNIN.
  2 commentaires
tayeb
tayeb le 17 Juil 2012
thank you !
Jan
Jan le 17 Juil 2012
Please note Daniel's warning, that assignin is a bad programming practize.

Connectez-vous pour commenter.

Plus de réponses (1)

khaled DAWOUD
khaled DAWOUD le 17 Juil 2012
you can use assignin function to reference to variable in the workspace in your function.

Catégories

En savoir plus sur Workspace Variables and MAT Files dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by