I had a well formed question from an advanced MATLAB user recently. He wanted to have an output come back from a GUI. There is an example of this with the modal dialog example in GUIDE. However, it takes some effort to know what parts of the example give this particular behavior. In this video, I make a very simple GUI that gives a return value by pasting from that example.
Here is the code I copied and pasted:
%%% OpeningFCN
uncomment uiwait
%%% OutputFCN
varargout{1} = handles.output;
% The figure can be deleted now
delete(handles.figure1);
%%% CloseReqFCN
if isequal(get(hObject, 'waitstatus'), 'waiting')
% The GUI is still in UIWAIT, us UIRESUME
uiresume(hObject);
else
% The GUI is no longer waiting, just close it
delete(hObject);
end
评论
要发表评论,请点击 此处 登录到您的 MathWorks 帐户或创建一个新帐户。