Variables become undefined although they are saved in Workspace

조회 수: 5 (최근 30일)
Mus'ab Ahmad
Mus'ab Ahmad 2016년 1월 13일
댓글: Adam 2016년 1월 13일
I read XML file using GUI pushbutton, extract some data, and do some manipulations for them. The thing is although I save the required variables to workspace (using assignin), I can't use them outside the pushbutton callback function for further manipulation because matlab tells me 'undefined variables'! any suggestions? Thanks
  댓글 수: 6
Adam
Adam 2016년 1월 13일
You need to make sure you click 'Attach File' after clicking the paper clip and choosing your file. A lot of people (including myself sometimes) miss that and think it is attached just through choosing the file under the paperclip.

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

채택된 답변

Ilham Hardy
Ilham Hardy 2016년 1월 13일
Did you also define the workspace location?
e.g.
assignin('base','your_variable_name',your_variable_value);
  댓글 수: 4
Mus'ab Ahmad
Mus'ab Ahmad 2016년 1월 13일
편집: Mus'ab Ahmad 2016년 1월 13일
Yes this what I meant; using it in another callback. It works now, thanks a lot.
Adam
Adam 2016년 1월 13일
If you just want to share data between callbacks then you shouldn't go through the base workspace at all, but I guess it works for you for now.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Workspace Variables and MAT Files에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by