Info

此问题已关闭。 请重新打开它进行编辑或回答。

Attempt to reference field of non-structure array

4 次查看(过去 30 天)
i am trying to display the values obtained by a variable h_dist in the edit text field but it is showing me the below error
My code is set(handles.edit1,'String',num2str(h_dist1)); set(handles.edit2,'String',num2str(h_dist2)); set(handles.edit3,'String',num2str(h_dist3));
the error is
Attempt to reference field of non-structure array.
Error in LBPFeature>TestingLBP_Callback (line 268) set(handles.edit1,'String',num2str(h_dist1));
Error in gui_mainfcn (line 96) feval(varargin{:});
Error in LBPFeature (line 42) gui_mainfcn(gui_State, varargin{:});
Error in @(hObject,eventdata)LBPFeature('TestingLBP_Callback',hObject,eventdata,guidata(hObject))
Error while evaluating uicontrol Callback
what do i do to display the values in the edit text box. im new to matlab so please help me
  1 个评论
Geoff Hayes
Geoff Hayes 2014-5-6
Which of the three lines is generating the error? Or is it some other line?
set(handles.edit1,'String',num2str(h_dist1)); set(handles.edit2,'String',num2str(h_dist2)); set(handles.edit3,'String',num2str(h_dist3));
The error message indicates that the code is trying to access a field (via the period) of a non-structure array. So in the above three lines of code, the potential error is due one of the three handles.edit1/2/3 accesses. You should put a breakpoint at the first of these three lines, and re-run the code until it pauses here. Look at the handles structures - does it have fields names edit1, edit2, and edit3? Is the structure empty? Are these the names of your edit boxes, or have their Tags changed?

回答(0 个)

此问题已关闭。

Community Treasure Hunt

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

Start Hunting!

Translated by