Documentation

Simulink.sdi.Signal class

Package: Simulink.sdi

Manages signal time series data and metadata

Description

The Simulink.sdi.Signal object contains the signal 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

expand all

Signal Properties (read only)

blockSourceBlock pathstring

Path to the block that defines the signal, stored as a string.

channelChannel indexinteger array

Channel index, stored as an integer array. This property applies to matrix data only. Matrix data is flattened into a scalar time series using channels.

dataSourceData sourcestring

Access to the signal data values, stored as a string.

dataValuesTime series valuesstructure

Time series data for this signal, stored as a structure.

fullBlockPathBlock pathstring

Block path to the signal with entire model hierarchy, stored as a string.

idSignal identifierinteger

Unique number identifying the signal, stored as a string.

modelSourceModel sourcestring

Name of the model that defines the signal, stored as a string.

portIndexBlock port indexinteger

Index of the block port that defines the signal, stored as an integer.

rootSourceRoot sourcestring

Access to the high-level logging structure this signal was derived from, stored as a string.

runIDRun identifierinteger

Run ID, a unique number identifying the signal's parent run, stored as an integer.

sampleDimsData sample dimensionsinteger

Dimensions of a data sample, stored as an integer.

sampleTimeSample timestring

Sample time of the signal derived from the model configuration settings, stored as a string.

SIDSimulink® identifierstring

Simulink identifier of the block that defines the signal, stored as a string. The SID format is model_name:sid_number. For details, see Locate Diagram Components Using Simulink Identifiers.

signalLabelSignal namestring

Name of the signal, stored as a string.

sourceTypeSignal source'logged' | 'visualized' | 'imported' | 'comparison'

Source of the signal from the model or Simulation Data Inspector, stored as a string. Sources from the model are logged or visualized. Sources from the Simulation Data Inspector are imported or comparison.

timeDimTime dimensioninteger

For any given data sample, the time dimension, stored as an integer.

timeSourceTime sourcestring

Access to the logged signal's time vector, stored as a string.

unitsPhysical unitsstring

Units of the signal if you are using physical modeling, stored as a string

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 baseline signal.

absTolAbsolute tolerance0 (default) | double

Absolute tolerance of the signal used for signal and run comparison, specified as a double. Must be a positive number.

interpMethodInterpolation method'linear' (default) | 'zoh'

Interpolation method to align data. Possible values are zero-order hold, 'zoh', and 'linear'.

relTolRelative tolerance0 (default) | double

Relative tolerance of the signal used for signal and run comparison, specified as a double. Must be a positive number.

syncMethodSynchronization method'union' (default) | 'uniform' | 'intersection'

Time synchronization method to align time vector when comparing signals, specified as a string. Possible values are 'intersection', 'uniform', or 'union'.

Visualization Properties (read and write)

checkedPlotted indicatorboolean

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

lineColorLine colorvector

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

lineDashedLine style'-' (default) | '--' | ':' | '-.'

Signal line format in the plot, specified as a string. Possible values are '-' solid, '--' dashed, ':' dotted, or '-.' dash-dot.

markerMarker symbol stylestring

Line marker style, specified as a string. Marker types and strings are the same as LineSpec in the plot function.

Examples

expand all

Modify Signal Data in a Run

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;

Related Examples

Introduced in R2012b

Was this topic helpful?