Documentation Center

  • Trial Software
  • Product Updates

Contents

Simulink.sdi.Signal class

Package: Simulink.sdi

Manages signal time series data and metadata

Description

The Simulink.sdi.Signal object contains the signal logging information for one simulation run. It also contains properties for visualizing and comparing signals.

Construction

The function Simulink.sdi.createRun creates a Simulink.sdi.Run object, which creates a Simulink.sdi.Signal object for each signal in the simulation output.

Properties

Signal Properties (read only)

id

Signal ID, a unique number identifying the signal.

runID

Run ID, a unique number identifying the signal's parent run.

rootSource

String to access the high-level logging structure this signal was derived from.

timeSource

String to access the logged signal's time vector.

dataSource

String to access the logged signal's data values.

dataValues

Time series data for this signal.

blockSource

String specifying the path to the block that defines the signal.

modelSource

String specifying the name of the model that defines the signal.

signalLabel

String specifying the name of the signal.

timeDim

For any given data sample, the time dimension.

sampleDims

Dimensions of a data sample.

portIndex

Index of the port that defines the signal.

channel

Channel index. This property applies to matrix data only. Matrix data is flattened into a scalar time series by using channels.

SID

Simulink Identifier of the block that defines the signal.

Comparison Properties (read and write)

Each signal has properties that the Simulation Data Inspector uses for comparing two signals. The Simulation Data Inspector uses the comparison properties from the first signal passed in, also called the reference signal.

absTol

Absolute tolerance of the signal. Must be a positive number.

relTol

Relative tolerance of the signal. Must be a positive number.

syncMethod

Time synchronization method to align time vector when comparing signals. Possible values are: 'intersection', 'uniform', and 'union'.

interpMethod

Interpolation method to align data. Possible values are: 'zoh' and 'linear'.

Visualization Properties (read and write)

lineColor

Signal line color in the plot in the form of a vector [r g b]. r is the red component, g the green component, and b the blue component.

lineDashed

Signal line format in the plot

checked

Boolean specifying if the signal is selected for plotting: true for selected and false for cleared.

Copy Semantics

Handle. To learn how handle classes affect copy operations, see Copying Objects in the MATLAB® documentation.

Examples

Create a run and call the Simulink.sdi.getSignal function to get a Simulink.sdi.Signal object.

% Configure model "slexAircraftExample" for logging and simulate
simOut = sim('slexAircraftExample', 'SaveOutput','on', ...
                   'SaveFormat', 'StructureWithTime', ...
                   'ReturnWorkspaceOutputs', 'on');
 
% Create a Simulation Data Inspector run which returns a list of signal IDs for   signals contained in the run
[~,~,signalIDs] = Simulink.sdi.createRun('My Run', 'base', {'simOut'});

% Get the signal object corresponding to the first signal ID
signalObj = Simulink.sdi.getSignal(signalIDs(1));
 
% signalObj is an instance of Simulink.sdi.Signal. Get the run ID for this signal
runID = signalObj.runID;
 
% Modify or define comparison and visualization properties for this signal
signalObj.syncMethod = 'intersection';
signalObj.lineColor = [1,0.4,0.6];
signalObj.lineDashed = '-';
signalObj.checked = true;

% View signals in the Simulation Data Inspector tool
Simulink.sdi.view;

See Also

| |

How To

Was this topic helpful?