'SliderStep',[0.05 0.2] specifies the fractional amount that the thumb moves when
the user clicks the arrow buttons or the slider trough (also called the channel). In this
case, the slider’s thumb position changes by the smaller amount (5 percent) when the
user clicks an arrow button. It changes by the larger amount (20 percent) when the user
clicks the trough.
Specify SliderStep to be a two-element vector, [minor_step major_step]. The
value of minor_step must be less than or equal to major_step. To ensure the best
results, do not specify either value to be less than 1e-6. Setting major_step to 1 or
higher causes the thumb to move to Max or Min when the trough is clicked.
As major_step increases, the thumb grows longer. When major_step is 1, the thumb is
half as long as the trough. When major_step is greater than 1, the thumb continues to
grow, slowly approaching the full length of the trough. When a slider serves as a scroll
bar, you can uses this behavior to indicate how much of the document is currently visible
by changing the value of major_step.
'Position',[30 20 150 30] specifies the location and size of the slider. In this
example, the slider is 150 pixels wide and 30 high. It is positioned 30 pixels from the left
of the figure and 20 pixels from the bottom.
NoteOn Mac platforms, the height of a horizontal slider is constrained. If the height you
set in the Position property exceeds this constraint, the displayed height of the slider is
the maximum allowed by the system. However, the value of the Position property does
not change to reflect this constraint.
Static Text
This code creates a static text component:
f = figure;
t = uicontrol(f,'Style','text',...
'String','Select a data set.',...
'Position',[30 50 130 30]);
Add Components to a Programmatic App