How can I get variable/data from OpenMenu to Callback?
조회 수: 2 (최근 30일)
이전 댓글 표시
Hi,
i have a uigetfile in an openmenuItem. I want that 'filename' in the callback. I looked at couple FAQ wikis but really dont get it.
function OpenMenuItem_Callback(hObject, eventdata, handles)
% hObject handle to OpenMenuItem (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
[filename, pathname] = uigetfile({'*.xls'},'File Selector');
function pushbutton1_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
[filename, pathname] = uigetfile({'*.xls'},'File Selector'); %* this line should be defeleted after it works, currently it works but I want to select file from openmenu.*
popup_sel_index = get(handles.popupmenu1, 'Value');
switch popup_sel_index
case 1
Calculation(filename, handles) %other m-file
end
댓글 수: 0
답변 (1개)
Walter Roberson
2012년 12월 31일
You cannot "return" a result from any Callback that has the object as its first argument (there are a small number of filtering callbacks such as zoom Post Action callbacks; they never pass in the object as the first argument.)
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Graphics Object Programming에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!