From: brihikaru on 12 May 2010 21:52 hi, i am facing this problem while executing GUI with the code that I programmed. there's massive error as below .. ??? Undefined function or variable 'xp'. Error in ==> transcoeff>radiobutton2_Callback at 125 subplot(1,2,1),plot(xp,Vp),axis([0,xp(12),0,max(pp,E_Inf(1))+0.2]),xlabel('Position, x (nm)'),ylabel('Potential energy, V(x) (eV)'); Error in ==> gui_mainfcn at 96 feval(varargin{:}); Error in ==> transcoeff at 42 gui_mainfcn(gui_State, varargin{:}); Error in ==> @(hObject,eventdata)transcoeff('radiobutton2_Callback',hObject,eventdata,guidata(hObject)) ??? Error while evaluating uicontrol Callback ??? Undefined function or variable 'xp'. Error in ==> transcoeff>radiobutton2_Callback at 125 subplot(1,2,1),plot(xp,Vp),axis([0,xp(12),0,max(pp,E_Inf(1))+0.2]),xlabel('Position, x (nm)'),ylabel('Potential energy, V(x) (eV)'); Error in ==> gui_mainfcn at 96 feval(varargin{:}); Error in ==> transcoeff at 42 gui_mainfcn(gui_State, varargin{:}); Error in ==> @(hObject,eventdata)transcoeff('radiobutton2_Callback',hObject,eventdata,guidata(hObject)) ??? Error while evaluating uicontrol Callback ??? Undefined function or variable 'xp'. Error in ==> transcoeff>radiobutton2_Callback at 125 subplot(1,2,1),plot(xp,Vp),axis([0,xp(12),0,max(pp,E_Inf(1))+0.2]),xlabel('Position, x (nm)'),ylabel('Potential energy, V(x) (eV)'); Error in ==> gui_mainfcn at 96 feval(varargin{:}); Error in ==> transcoeff at 42 gui_mainfcn(gui_State, varargin{:}); Error in ==> @(hObject,eventdata)transcoeff('radiobutton2_Callback',hObject,eventdata,guidata(hObject)) I am still new with matlab especially with gui..does anyone knows how to combine the coding with GUI ? I need help here..anyone please ^,^ bri
From: Walter Roberson on 12 May 2010 22:29 brihikaru wrote: > hi, i am facing this problem while executing GUI with the code that I > programmed. there's massive error as below .. > > > ??? Undefined function or variable 'xp'. > > Error in ==> transcoeff>radiobutton2_Callback at 125 > subplot(1,2,1),plot(xp,Vp),axis([0,xp(12),0,max(pp,E_Inf(1))+0.2]),xlabel('Position, > x (nm)'),ylabel('Potential energy, V(x) (eV)'); > > Error in ==> gui_mainfcn at 96 > feval(varargin{:}); > > Error in ==> transcoeff at 42 > gui_mainfcn(gui_State, varargin{:}); > > Error in ==> > @(hObject,eventdata)transcoeff('radiobutton2_Callback',hObject,eventdata,guidata(hObject)) It appears that you have coded radiobutton2_Callback to refer to a variable named 'xp' that you did not define within that routine nor within any routine that radiobutton2_Callback was defined within. Variables do not simply "float around" waiting to be referenced. If you want a variable be accessible within another routine, you have to take deliberate steps to make it accessible, such as by storing it in the handles structure via the guidata() command and then fetching it from that structure when you need it.
From: brihikaru on 13 May 2010 05:36 hi..thanks for the feedback.. but it still stays there's " Error while evaluating uimenu Callback" what should i do with that?
From: Walter Roberson on 13 May 2010 10:17 brihikaru wrote: > hi..thanks for the feedback.. > but it still stays there's " Error while evaluating uimenu Callback" > what should i do with that? I would put in a breakpoint in the callback and then run, and single step until I had found the error.
From: brihikaru on 13 May 2010 15:54
Walter Roberson <roberson(a)hushmail.com> wrote in message <yRTGn.5067$V%2.1324(a)newsfe08.iad>... > brihikaru wrote: > > hi..thanks for the feedback.. > > but it still stays there's " Error while evaluating uimenu Callback" > > what should i do with that? > > I would put in a breakpoint in the callback and then run, and single > step until I had found the error. sorry but how to put the breakpoint in the callback? |