필터 지우기
필터 지우기

Returning values in a GUI Callback

조회 수: 9 (최근 30일)
Rick
Rick 2012년 4월 23일
How do you return a value from the callback routine(File_Select_Callback), back up to the calling routine (Selection), In the following example,
What I want is the directory path from the* uigetfile* function back up to the calling funtion.
function Selection
Input_Select = uicontrol('Style','pushbutton','String','
Select Inoput File', 'Position', [300 50 100 25],
'Callback'...,{@File_Select_Callback});
end
*function File_Select_Callback* (hObject,eventdata)
[filename,Path] = *uigetfile*('*.*','Select the File', 'MultiSelect','on');
end

답변 (2개)

Sean de Wolski
Sean de Wolski 2012년 4월 23일
most Callbacks do not return output arguments. What it looks like you want it for the UICONTROL, upon being pushed, to return stuff. This will not work. Instead once you get the filename and path, store these to application data (setappdata/getappdata) or to the field of another uicontrol (perhaps a static text box). You can then access these from elsewhere.
  댓글 수: 2
Walter Roberson
Walter Roberson 2012년 4월 23일
*Most* callbacks. zoom ButtonDownFilter is an example of something that is designated a callback but returns a value.
Sean de Wolski
Sean de Wolski 2012년 4월 23일
true!

댓글을 달려면 로그인하십시오.


Walter Roberson
Walter Roberson 2012년 4월 23일
It is not possible to return a value from most callbacks; you can only return a value from filter functions such as the zoom ButtonDownFilter.

카테고리

Help CenterFile Exchange에서 Migrate GUIDE Apps에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by