How to use varargout in a GUI

조회 수: 15(최근 30일)
Simon Aldworth
Simon Aldworth 2018년 10월 23일
댓글: Walter Roberson 2018년 10월 24일
There is clearly something I don't understand about getting data from a gui into my main code. For the purposes of an example, I created a gui using GUIDE that contained a single edit box that I left exactly as it was created. In the automatically generated code are lines in OpeningFcn that define handles.output and update guidata:
function dummy_OpeningFcn(hObject, eventdata, handles, varargin)
% Choose default command line output for dummy
handles.output = hObject;
% Update handles structure
guidata(hObject, handles);
Then, in the OutputFcn, varargout{1} is set equal to handles.output:
function varargout = dummy_OutputFcn(hObject, eventdata, handles)
% Get default command line output from handles structure
varargout{1} = handles.output;
When I run the gui I don't see any variables in the main workspace. What is varargout for if not to pass data to the main workspace? Is there something missing from the automatically generated code that I need to insert so I can access handles.output in the main workspace?
  댓글 수: 13

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



Find more on Programming Utilities in Help Center and File Exchange




Community Treasure Hunt

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

Start Hunting!

Translated by