GUI not storing handles correctly
Ältere Kommentare anzeigen
data is a folder containing about 12 excel files
I need the data in the entire column of each excel file labeled "HeadRight"
The data is to later be put into a matrix using a user defined function and then used to build a graph via the patchline function.
However, every time I run the code, it says that "HeadRight" is undefined code:
% --- Executes on button press in headdata.
function headdata_Callback(hObject, eventdata, handles)
% hObject handle to headdata (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hint: get(hObject,'Value') returns toggle state of headdata
handles = guidata(hObject);
if (get(hObject,'Value') == get(hObject,'Max'))
for i = 1:length(handles.data)
handles.datapatch = handles.data(i).HeadRight
handles.int = handles.data(1).DetectionCode
guidata(hObject,handles)
display('headdata works')
end
end
end
5 Kommentare
per isakson
am 9 Nov. 2014
Bearbeitet: per isakson
am 9 Nov. 2014
Have did you verified that
handles.data(*).HeadRight
is assigned values correctly? Where is it done?
Zeke Merchant
am 9 Nov. 2014
Image Analyst
am 9 Nov. 2014
Bearbeitet: Image Analyst
am 9 Nov. 2014
headdata is a pushbutton. Why are you checking its max property?
How did you attach an array called "data" to the handles structure? And then how did you attach HeadRight to the handles.data structure array?
Jan
am 9 Nov. 2014
@Zeke Merchant: I do not understand, where HeadRight is created. It is not created in the posted code, so I guess you fogot a guidata update after it has been defined anywhere else.
Please care for posting a full copy of the error message. A rough rephrasing cinceals important details usually.
Zeke Merchant
am 9 Nov. 2014
Antworten (1)
Image Analyst
am 9 Nov. 2014
Evidently your "data" field does not have a HeadRight field. What does this say:
fn = fieldnames(handles.data(1))
in the command window.
Kategorien
Mehr zu Data Import from MATLAB finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!