User`s guide
3 How to Create a Simple GUI Programmatically
hcontour = uicontrol('Style','p ushbutton',...
'String','Countour','Position',[315 ,135,70,25]);
These statements use the uicontrol function to create the push buttons.
Each statement uses a series of property/value pairs to define a push
button.
Property Description
Style
In the example, pushbutton specifies the component as a
push button.
String
Specifies the label that appears on each push button.
Here, there are three types of plots:
Surf, Me sh, Contour.
Position
Uses a four-element vector to specify the location of each
push button within the GUI and its size: [distance from
left, distance from bottom, width, height]. Default units
for push buttons are pixels.
Each call returns the handle of the component that is created.
2 Add the pop-up menu and its label to your GUI by adding these statements
to the code file following the push button d efinitions.
hpopup = uicontrol('Style','popupm enu',...
'String',{'Peaks','Membrane','Sinc'},. ..
'Position',[300,50,100,25]);
htext = uicont rol( 'Style','text','String', 'Select Data',...
'Position',[325,90,60,15]);
For the pop-up menu, the String property uses a cell array to specify the
three items in the pop-up m enu:
Peaks, Membrane, Sin c.Thestatictext
component serves as a label f or the pop-up menu. Its
String property
tells the GUI user to
Select Data. Default units for these components
are pixels.
3 Add the axes to the GUI by adding this statement to the code file. Set
the
Units property to pixels so that it has the same units as the other
components.
ha = axes('Units','pixels','Positi on',[50,60,200,185]);
3-8