User`s guide
8 Programming a GUIDE GUI
.
.
.
The if block loops through the odd elements of varargi n checking for
property names or aliases, and the
case blocks assign the following (even)
varargin element as a value to the appropriate property of the figure or one
of its compone nts. You can add more cases to handle additional property
assignments that you want the opening function to perform.
Initial Template Code
Initially, the input function template contains these lines of code:
•
handles.output = hObject adds a new element, out put,tothehandles
structure and assigns it the value of the input argument hObject,whichis
the handle of the figure, i.e., the handle of the GUI. This handle is used
later by the output function. For more information about the output
function, see “Output Function” on page 8-28.
•
guidata(hObject,handles) saves the handles structure. You must use
guidata to save any changes that you make to the han dles structure.
It is not sufficient just to set the value of a
handles field. See “handles
Structure” on page 8-22 and “GUI Data” on page 9-7 for more information.
•
uiwait(handles.mygui), initially commented out, blocks GUI e xecution
until
uiresume is called or the G UI is deleted. Note th a t uiwait allows the
user access to other MATLAB windows. Remove the comment symbol for
this statem ent if you want the GUI to be blocking when it opens.
Output Function
The output function re turns, to the command line, outputs that are generated
during its execution. It is executed when the opening function returns control
and before control returns to the command line. This means that you must
generate the outputs in the opening function, or call
uiwait in the opening
function to pause its execution while other callbacks generate outputs.
• “Function Naming and Template” on page 8-29
• “Input Arguments” on pag e 8-29
• “Output Arguments” on page 8-29
8-28