GUI not storing handles correctly
1 view (last 30 days)
Show older comments
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 Comments
Jan
on 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.
Answers (1)
Image Analyst
on 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.
See Also
Categories
Find more on Interactive Control and Callbacks in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!