Main Content

LatchButton

Create latch button for instrument panel UI

Since R2024a

Description

example

hLatchButton = slrealtime.ui.control.LatchButton(hFigure) creates a latch button for an instrument panel uifigure figure. This button downloads the OnValue when the button is pressed by using the computer mouse or other pointing device and retains (latches) this value until the button is again pressed. When the button is released (pressed a second time), the value reverts to the original value from before the first press of the button. You can disable this display by using a button property.

For information about control properties, see slrealtime.ui Properties. If deploying an app, it is important to set the TargetSource property for this control.

Examples

collapse all

Create a real-time application latch button and adjust the position of the button.

% Create figure
hFig = uifigure();
% Create latch button component
hLoaded = slrealtime.ui.control.LatchButton(hFig);
% Change position of the component
hLatched.Position = [0 0 200 200];
% Customize
hLatched.BlockPath = 'testmodel/Constant6';
hLatched.ParameterName = 'Value';
hLatched.OnValue = 1;

Input Arguments

collapse all

The hFigure argument identifies the uifigure to which you are adding the UI component.

Example: hFig = uifigure()

Data Types: function_handle

Output Arguments

collapse all

The hLatchButton argument is the handle to the latch button component that you create.

Version History

Introduced in R2024a