主要内容

本页采用了机器翻译。点击此处可查看英文原文。

StartStopButton

为仪表盘用户界面创建启动/停止实时应用程序按钮

自 R2021b 起

说明

hStartStopButton = slrealtime.ui.control.StartStopButton(hFigure) 为仪表板 uifigure 图示创建一个 Speedgoat® 目标计算机启动/停止按钮。此按钮用于启动或停止目标计算机上运行的实时应用程序,并显示当前应用程序的状态。

  • 当按钮显示 Start 图标和文本时,目标计算机未运行任何应用程序。点击按钮组件将启动应用程序。

  • 当按钮显示 Stop 图标和文本时,目标计算机正在运行应用程序。点击按钮组件将停止应用程序。

该按钮提供 Reload On Stop 选项。

有关控制属性的信息,请参阅 slrealtime.ui Properties。若计划在默认目标计算机之外的其他计算机上使用该应用程序,则必须为该控件设置 TargetSource 属性。

示例

示例

全部折叠

创建一个实时应用程序的启动/停止按钮,并调整按钮的位置。

% 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';

输入参数

全部折叠

hFigure 参量标识了您要向其添加 UI 组件的 uifigure

示例: hFig = uifigure()

数据类型: function_handle

输出参量

全部折叠

hStartStopButton 参数是您创建的启动-停止按钮组件的句柄。

版本历史记录

在 R2021b 中推出

全部展开