Add Components to a Programmatic UI
The first argument passed to uipanel, f, specifies the parent container. In this case,
the parent is a figure, but you can also specify the parent to be any container, such as
another panel or a button group.
'Title','My Panel' specifies a title to display on the panel.
'Position',[.25 .1 .5 .8] specifies the location and size of the panel as a fraction
of the parent container. In this case, the panel is 50 percent of the width of the figure and
80 percent of its height. The left edge of the panel is located at 25 percent of the figure’s
width from the left. The bottom of the panel is located 10 percent of the figure’s height
from the bottom. If the figure is resized, the panel retains its original proportions.
The following commands add two push buttons to the panel. Setting the Units property
to 'normalized' causes the Position values to be interpreted as fractions of the parent
panel. Normalized units allow the buttons to retain their original proportions when the
panel is resized.