Documentation

Simulink.HMI.SignalSpecification class

Package: Simulink.HMI

Information for logging a signal

Description

The Simulink.HMI.SignalSpecification object contains the block path and port index required by Simulink.sdi.markSignalForStreaming to turn logging on or off for a signal.

Construction

sigSpec = instSigs.get(index) returns the Simulink.HMI.SignalSpecification object sigSpec for the signal at the specified index in the Simulink.HMI.InstrumentedSignals object instSigs.

Input Arguments

expand all

Numeric index of the signal within the Simulink.HMI.InstrumentedSignals object.

Example: 1

Properties

expand all

Simulink.BlockPath object with the block path for the signal.

Index of the signal on the output port of its block. For Stateflow signals, the OutputPortIndex is set to 1.

Copy Semantics

Value. To learn how value classes affect copy operations, see Copying Objects (MATLAB).

Examples

expand all

This example shows how to obtain the block paths for logged signals and remove the logging badge for a signal using Simulink.HMI.InstrumentedSignals and Simulink.HMI.SignalSpecification objects.

Get InstrumentedSignals Object

% Load the model sldemo_absbrake
load_system('sldemo_absbrake')

% Get logged signals with Simulink.HMI.InstrumentedSignals object
instSigs = get_param('sldemo_absbrake', 'InstrumentedSignals');

% Check logged signals count
instSigs.Count
ans =

  uint32

   2

Inspect Block Paths with SignalSpecifications Objects

Use the get method to get the Simulink.HMI.SignalSpecification objects for each of the signals in the Simulink.HMI.InstrumentedSignals object

% Get Simulink.HMI.SignalSpecification objects
sig1 = instSigs.get(1);
sig2 = instSigs.get(2);

% Inspect block paths for signals
blockPath1 = sig1.BlockPath
blockPath2 = sig2.BlockPath
blockPath1 = 

  Simulink.BlockPath
  Package: Simulink

  Block Path:
    'sldemo_absbrake/Bus Creator'

  Use the getBlock method to access block path character vectors from this object.

blockPath2 = 

  Simulink.BlockPath
  Package: Simulink

  Block Path:
    'sldemo_absbrake/Relative Slip'

  Use the getBlock method to access block path character vectors from this object.

Remove Logging Badge for Bus Signal

Remove the logging badge for the signal from the Bus Creator block.

% Get block path string and port index for the Bus Creator signal
blockPath_str = blockPath1.getBlock(1);
portIndex = sig1.OutputPortIndex;

% Clear the logging badge for the Bus Creator signal
Simulink.sdi.markSignalForStreaming(blockPath_str, portIndex, 'off')

Introduced in R2015b

Was this topic helpful?