主要内容

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

SignalTable

为仪表盘 UI 创建信号表

自 R2021b 起

说明

hSigTable = slrealtime.ui.control.SignalTable(hFigure) 为仪表板 uifigure 图形创建可编辑信号表显示。仅可编辑 Enabled 列,以启用或禁用信号向该表传输其值的功能。显示屏显示您在实时应用程序中选择用于流式传输的信号。当仪表盘应用程序运行时,SignalTable 组件提供右键菜单,可用于选择要添加或移除的信号显示。

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

示例

示例

全部折叠

创建信号表并调整表格位置。

% Create figure 
hFig = uifigure(); 
% Create signal table component 
hSTable = slrealtime.ui.control.SignalTable(hFig); 
hSTable.Signals = struct( ... 
  'BlockPath', {'testmodel/Constant1', 'testmodel/Constant2', ...
                'testmodel/Sine Wave', 'testmodel/str2', ...
				'testmodel/Switch1'}, ... 
  'PortIndex', {1, 1, 1, 1, 1}, . . .
  'Decimation', {1, 2, 5, 1, 1}, . . .
  'ArrayIndex', {[], [], 2, [2 2], 3}, . . .
  'BusElement', {'', 'b', '', 'z', 'a'}, . . .
  'Callback', {[], cb, [], [], []}); 
% Change position of the component 
hSTable.Position = [0 0 200 200]; 
% Customize 
hSTable.FontWeight = 'bold'; 
hSTable.FontAngle = 'italic';

创建信号表并调整表格位置。在 Signals 属性中使用信号名称时,BlockPath 选择信号名称,而 PortIndex 的值为 -1

% Create figure 
hFig = uifigure(); 
% Create signal table component 
hSTable = slrealtime.ui.control.SignalTable(hFig); 
hSTable.Signals = struct( ... 
  'BlockPath', {'testmodel/Constant1', 'testmodel/Constant2', ...
                'Sine', 'String', 'testmodel/Switch1'}, ... 
  'PortIndex', {1, 1, -1, -1, 1}); 
  'Decimation', {1, 2, 5, 1, 1}, . . .
  'ArrayIndex', {[], [], 2, [2 2], 3}, . . .
  'BusElement', {'', 'b', '', 'z', 'a'}, . . .
  'Callback', {[], cb, [], [], []}); 
% Change position of the component 
hSTable.Position = [0 0 200 200]; 
% Customize 
hSTable.FontWeight = 'bold'; 
hSTable.FontAngle = 'italic';

输入参数

全部折叠

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

示例: hFig = uifigure()

数据类型: function_handle

输出参量

全部折叠

hSignTable 参数是您创建的信号表组件的句柄。

版本历史记录

在 R2021b 中推出

全部展开