h = uiswitch()
h = uiswitch(parent)
h = uiswitch(..., propertyName, propertyValue)
| Parameter | Description |
|---|---|
| parent | parent container. |
| propertyName, propertyValue | name-value pairs. |
| Parameter | Description |
|---|---|
| h | UI component object. |
sw = uiswitch(parent, style) creates a two-state switch: styles 'slider' (default), 'rocker', 'toggle'. Items holds the two state labels; Value/ValueIndex/ItemsData follow the usual mapping; ValueChangedFcn reports changes.
f = uifigure('Visible', 'off', 'Name', 'Switches', 'Position', [100 100 520 300]);
sw = uiswitch(f, 'Position', [120 135 90 32]);
sw.Value = 'On';
rsw = uiswitch(f, 'rocker');
rsw.Position = [300 90 48 100];
rsw.Value = 'On';
drawnow();
f = uifigure();
sw = uiswitch(f, 'Items', {'Stop', 'Go'});
sw.Value = 'Go';
| Version | Description |
|---|---|
| 2.0.0 | initial version |