GUI not storing handles correctly
조회 수: 1 (최근 30일)
이전 댓글 표시
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
Jan
2014년 11월 9일
@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.
답변 (1개)
Image Analyst
2014년 11월 9일
Evidently your "data" field does not have a HeadRight field. What does this say:
fn = fieldnames(handles.data(1))
in the command window.
참고 항목
카테고리
Help Center 및 File Exchange에서 Interactive Control and Callbacks에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!