User`s guide
15 Examples of GUIs Created Programmatically
'plot(membrane)', @(a)plot(a,membrane);
'surf(peaks)', @(a)surf(a,peaks)};
Because the data is created at the top level of the GUI function, it is available
to all callbacks and other functions in the GUI.
For information about using anonymous functions, see “Anonymous
Functions” .
Create the GUI and Its Components
Likethedata,thecomponentsarecreatedatthetoplevelsothattheir
handles are available to all callbacks and other functions in the GUI.
• “The Main Figure” on page 15-8
• “The Axes” on page 15-9
• “The Pop-Up Menu” on page 15-10
• “The Update Push Button” on page 15-10
• “The File Menu and Its M enu Items” on page 15-11
• “The Toolbar and Its Tools” on page 15-12
The Main Figure
The following statement creates the figure for GUI.
hMainFigure = figure(... % The main GUI figure
'MenuBar','none', .. .
'Toolbar','none', .. .
'HandleVisibility','callback', ...
'Color', get(0,...
'defaultuicontrolbackgroundcolor'));
• The figure function creates the GUI figure.
• Setting the
MenuBar and Toolbar properties to none, prevents the standard
menu bar and toolbar from displaying.
15-8