I get Undefined function or variable eror but that veriable is in Workspace

조회 수: 2 (최근 30일)
I get under eror but that veriable is in Workspace
??? Error using ==> eval
Undefined function or variable 'mn'.% but before using of eval, I defined 'mn' and now the 'mn' is in workspace
Error in ==> LEDbar>pushbutton1_Callback at 346
gathd=eval(MAXmatris);
Error in ==> gui_mainfcn at 96
feval(varargin{:});
Error in ==> LEDbar at 42
gui_mainfcn(gui_State, varargin{:});
Error in ==>
@(hObject,eventdata)LEDbar('pushbutton1_Callback',hObject,eventdata,guidata(hObject))
??? Error while evaluating uicontrol Callback
but before using of eval, I defined 'mn' and now the 'mn' is in workspace.
I am really confused for what tells 'mn' is undefined.
any idea?
  댓글 수: 1
mohammad
mohammad 2012년 8월 7일
편집: mohammad 2012년 8월 7일
I run this by a GUI (so eval('mn') is inside of gui function)

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

채택된 답변

Matt Fig
Matt Fig 2012년 8월 7일
편집: Matt Fig 2012년 8월 7일
When you say you define the variable in the workspace, which workspace are you talking about? Do you mean it is defined in the base workspace (the command line)? If so, then that variable is not visible inside the callback, which has its own workspace. You could use EVALIN('base',...) but this may not make your problem go away, depending on what you are trying to accomplish.
Why are you using EVAL in a callback anyway?
  댓글 수: 4
mohammad
mohammad 2012년 8월 7일
편집: mohammad 2012년 8월 7일
Matt I must use that I have no other way. I described reasons here
Now, by using
t=[];
evalin('base','t',mn) (that you told)
the problem was solved and really thanks. But I have exactly the same problem with the next line. I use evalin('base','p',op); but errors that op is not defined (however it's in base workspace). for what by using evalin, it errors the same for other line?!
mohammad
mohammad 2012년 8월 7일
Oh, OK by using t=evalin('base',mn); the problem now solved. Really thanks.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by