Main Content

StartStopButton

Create start-stop real-time application button for instrument panel UI

Since R2021b

Description

example

hStartStopButton = slrealtime.ui.control.StartStopButton(hFigure) creates a target computer start-stop button for an instrument panel uifigure figure. This button starts or stops a real-time application running on the target computer and displays the state of the current application.

  • When the button displays the Start icon and text, the target computer is not running an application. Clicking the button component starts the application.

  • When the button displays the Stop icon and text, the target computer is running an application. Clicking the button component stops the application.

The button provides an option to Reload On Stop.

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 start-stop button and adjust the position of the button.

% Create figure 
hFig = uifigure(); 
% Create start/stop component 
hStarted = slrealtime.ui.control.StartStopButton(hFig); 
% Change position of the component 
hStarted.Position = [0 0 200 200]; 
% Associate with default target 
hStarted.TargetSource = []; 
% Configure start options
hStarted.ReloadOnStop = 1;
hStarted.AutoImportFileLog = 1;
hStarted.ExportToBaseWorkspace = 1; 
% Customize 
hStarted.StartIcon = fullfile(pwd, 'start.png'); 
hStarted.StartText = 'START ME'; 
hStarted.StartIcon = fullfile(pwd, 'stop.png'); 
hStarted.StartText = 'STOP ME';

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 hStartStopButton argument is the handle to the start-stop button component that you create.

Version History

Introduced in R2021b

expand all