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

조회 수: 6 (최근 30일)
tayeb
tayeb 2012년 7월 17일
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일
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
Jan
Jan 2012년 7월 17일
Please note Daniel's warning, that assignin is a bad programming practize.

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

추가 답변 (1개)

khaled DAWOUD
khaled DAWOUD 2012년 7월 17일
you can use assignin function to reference to variable in the workspace in your function.

카테고리

Help CenterFile Exchange에서 Whos에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by