Info

Cette question est clôturée. Rouvrir pour modifier ou répondre.

Attempt to reference field of non-structure array

2 vues (au cours des 30 derniers jours)
Jeevan
Jeevan le 6 Mai 2014
Clôturé : MATLAB Answer Bot le 20 Août 2021
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 commentaire
Geoff Hayes
Geoff Hayes le 6 Mai 2014
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?

Réponses (0)

Cette question est clôturée.

Community Treasure Hunt

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

Start Hunting!

Translated by