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

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 ;)

 Akzeptierte Antwort

Daniel Shub
Daniel Shub am 17 Jul. 2012

2 Stimmen

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 Kommentare

thank you !
Please note Daniel's warning, that assignin is a bad programming practize.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (1)

khaled DAWOUD
khaled DAWOUD am 17 Jul. 2012

0 Stimmen

you can use assignin function to reference to variable in the workspace in your function.

Kategorien

Mehr zu Scope Variables and Generate Names finden Sie in Hilfe-Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by