User`s guide
12 Code a Programmatic GUI
Most components have Visible properties. You can also use these properties
to make individual components invisible.
Return Output to the User
If your GUI function provides for an argument to the left of the equal sign, and
the user specifies such an argument, then you want to return the expected
output. The code that provides this output usually appears just before the
GUI m ain function returns.
In the example shown here, taken from the Icon Editor example code file,
1 Acalltouiwait blocks execution until uiresum e is called or the current
figure is deleted.
2 While execution is blocked, the GUI user creates the desired icon.
3 When the user signals completion of the icon by clicking OK, the routine
that services the OK push button calls
uiresume and control returns to the
stateme nt foll owing t he call to
uiwait.
4 The GUI then returns the completed icon to the user as output of the GUI.
% Make the GUI blocking.
uiwait(hMainFigure);
% Return the edited icon CD ata if it is requested.
mOutputArgs{1} = mIconCData;
if nargout>0
[varargout{1:nargout}] = mOutputAr gs{:};
end
mIconData
contains the icon that the user created or edited. mOutputArgs is a
cell array defined to hold the output arguments.
nargout indicates how many
output arguments the user has supplied.
varargout contains the optional
output arguments returned by the GUI. See the complete Icon Editor code file
for more information.
12-6