GUI not storing handles correctly
Mostrar comentarios más antiguos
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 comentarios
per isakson
el 9 de Nov. de 2014
Editada: per isakson
el 9 de Nov. de 2014
Have did you verified that
handles.data(*).HeadRight
is assigned values correctly? Where is it done?
Zeke Merchant
el 9 de Nov. de 2014
Image Analyst
el 9 de Nov. de 2014
Editada: Image Analyst
el 9 de Nov. de 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
el 9 de Nov. de 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
el 9 de Nov. de 2014
Respuestas (1)
Image Analyst
el 9 de Nov. de 2014
Evidently your "data" field does not have a HeadRight field. What does this say:
fn = fieldnames(handles.data(1))
in the command window.
1 comentario
Zeke Merchant
el 9 de Nov. de 2014
Categorías
Más información sobre Data Import from MATLAB en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!