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)

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

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.

Access to the signal data values, stored as a character vector.

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

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

Unique number identifying the signal, stored as a character vector.

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

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

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

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

Dimensions of a data sample, stored as an integer.

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

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

Name of the signal, stored as a character vector.

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

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

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

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

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.

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

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

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

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

Visualization Properties (read and write)

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

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.

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

Line marker style, specified as a character vector. Marker types and character vectors are the same as LineSpec in the plot function.

Examples

expand all

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?