Using a function to create a global variable in the workspace

조회 수: 1 (최근 30일)
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.

채택된 답변

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

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

추가 답변 (0개)

카테고리

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

제품

Community Treasure Hunt

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

Start Hunting!

Translated by