I get Undefined function or variable eror but that veriable is in Workspace
2 views (last 30 days)
Show older comments
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?
Accepted Answer
Matt Fig
on 7 Aug 2012
Edited: Matt Fig
on 7 Aug 2012
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 Comments
More Answers (0)
See Also
Categories
Find more on Loops and Conditional Statements in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!