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

 채택된 답변

Daniel Shub
Daniel Shub 2012년 7월 17일

2 개 추천

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

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

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

khaled DAWOUD
khaled DAWOUD 2012년 7월 17일

0 개 추천

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

카테고리

도움말 센터File Exchange에서 Workspace Variables and MAT Files에 대해 자세히 알아보기

질문:

2012년 7월 17일

Community Treasure Hunt

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

Start Hunting!

Translated by