Prev: Really need help with Maximum Likelihood estimation and Kalman Filter
Next: how to generate the gobor wavelet for face classification
From: Peter on 6 Aug 2010 10:30 I am trying to create a GUI to enable the user to edit a pair of arrays (databases) in a merging process. I am having trouble with the GUI in accessing variables within pushbutton functions: ??? Undefined function or variable 'selectedcells1'. Error in ==> GUI_test>pushbutton4_Callback at 128 [row1,columns1] = size(selectedcells1); Error in ==> gui_mainfcn at 96 feval(varargin{:}); Error in ==> GUI_test at 42 gui_mainfcn(gui_State, varargin{:}); Error in ==> @(hObject,eventdata)GUI_test('pushbutton4_Callback',hObject,eventdata,guidata(hObject)) ??? Error while evaluating uicontrol Callback EDU>> whos global Name Size Bytes Class Attributes k 1x1 8 double global m1 1x1 8 double global m2 1x1 8 double global n1 1x1 8 double global n2 1x1 8 double global num 133x13 13832 double global num1 149x20 23840 double global num2 0x0 0 double global selectedcells1 1x2 16 double global selectedcells2 1x2 16 double global how can my program tell me the variable is undefined, when it is a global variable? Also any direction towards a more correct method would be much appreciated since i have read that using global functions isn't a particularly good idea.
From: Sean on 6 Aug 2010 11:44
"Peter " <dutton.peter(a)gmail.com> wrote in message <i3h6a0$gqa$1(a)fred.mathworks.com>... > I am trying to create a GUI to enable the user to edit a pair of arrays (databases) in a merging process. > > I am having trouble with the GUI in accessing variables within pushbutton functions: > > ??? Undefined function or variable 'selectedcells1'. > > Error in ==> GUI_test>pushbutton4_Callback at 128 > [row1,columns1] = size(selectedcells1); > > Error in ==> gui_mainfcn at 96 > feval(varargin{:}); > > Error in ==> GUI_test at 42 > gui_mainfcn(gui_State, varargin{:}); > > Error in ==> > @(hObject,eventdata)GUI_test('pushbutton4_Callback',hObject,eventdata,guidata(hObject)) > > > ??? Error while evaluating uicontrol Callback > > EDU>> whos global > Name Size Bytes Class Attributes > > k 1x1 8 double global > m1 1x1 8 double global > m2 1x1 8 double global > n1 1x1 8 double global > n2 1x1 8 double global > num 133x13 13832 double global > num1 149x20 23840 double global > num2 0x0 0 double global > selectedcells1 1x2 16 double global > selectedcells2 1x2 16 double global > > > how can my program tell me the variable is undefined, when it is a global variable? Also any direction towards a more correct method would be much appreciated since i have read that using global functions isn't a particularly good idea. You need to define it as global in the callback i.e.: global celectedcells1 A better way: doc setappdata doc getappdata |