MATLAB Creating Graphical User Interfaces

(Barry) #1

11 Code a Programmatic UI


1 A call to uiwait blocks execution until uiresume is called or the current figure is
deleted.
2 While execution is blocked, the user creates the icon.
3 When the user clicks OK, that push button’s callback calls the uiresume function.
4 The program returns the completed icon to the user as output.

% Make the window blocking.
uiwait(hMainFigure);

% Return the edited icon CData if it is requested.
mOutputArgs{1} = mIconCData;
if nargout>0
[varargout{1:nargout}] = mOutputArgs{:};
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 program. See the complete Icon Editor code file for more information.
Free download pdf