Create button group to manage radio buttons and toggle buttons
bg = uibuttongroup
creates a button group in the current figure and
returns the ButtonGroup
object. If there is no figure available,
MATLAB® calls the figure
function to create one.
bg = uibuttongroup(
specifies button group property values using one or more name-value pair
arguments.Name,Value
)
bg = uibuttongroup(
creates the button group in the specified parent container. The parent container can be
a figure created with either the parent
)figure
or uifigure
function, or a child container
such as a panel. Property values for uibuttongroup
vary slightly
depending on whether the app is created with the figure
or
uifigure
function. For more information, see Name-Value Pair Arguments.
bg = uibuttongroup(
specifies the parent container and one or more properties values.parent
,Name,Value
)
A button group can contain any UI component type, but it only manages the selection of radio buttons and toggle buttons.
To make your program respond when the app user selects
a radio button or toggle button that is inside a button group. define
a SelectionChangedFcn
callback function for the
button group. You cannot define callbacks for the individual buttons.
To determine which radio button or toggle button is
selected, query the SelectedObject
property
of the button group. You can execute this query anywhere in your code.
If you set the Visible
property
of a button group object to 'off'
, then any child
objects it contains (buttons, other button groups, etc.) become invisible
along with the parent button group. However, the Visible
property
value of each child object remains unaffected.