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
Comments
To leave a comment, please click here to sign in to your MathWorks Account or create a new one.