GUI not storing handles correctly
Afficher commentaires plus anciens
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 commentaires
per isakson
le 9 Nov 2014
Modifié(e) : per isakson
le 9 Nov 2014
Have did you verified that
handles.data(*).HeadRight
is assigned values correctly? Where is it done?
Zeke Merchant
le 9 Nov 2014
Image Analyst
le 9 Nov 2014
Modifié(e) : Image Analyst
le 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
le 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
le 9 Nov 2014
Réponses (1)
Image Analyst
le 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.
Catégories
En savoir plus sur Spreadsheets dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!