Simulink.sdi.DiffSignalResult class

Package: Simulink.sdi

Access signal comparison results


The Simulink.sdi.DiffSignalResult object provides access to the data and metadata created by a signal comparison. A Simulink.sdi.DiffSignalResult object gives access the difference signal, tolerance data, and the synchronized signal data.


DiffSignalObj = Simulink.sdi.compareSignals(signalID1, signalID2) creates a Simulink.sdi.DiffSignalResult object to provide access to the results of the comparison of the signals corresponding to sigID1 and sigID2.

DiffSignalObj = DiffRunObj.getResultByIndex(index) returns a Simulink.sdi.DiffSignalResult object for the signal comparison corresponding to the index within a Simulink.sdi.DiffRunResult object.

Input Arguments

expand all

Numeric signal identifier for the Baseline signal in comparison.

Numeric signal identifier for the Compare to signal in comparison.

Index of the signal within the run.


expand all

Indicates the status of the DiffSignalResult object. The status can indicate where a given signal comparison is in a comparison process during a long comparison, or it can indicate information about the result of the signal comparison.

  • WithinTolerance — Signal comparison completed, and all data points compared fell within the specified tolerance.

  • OutOfTolerance — Signal comparison completed, and some data points compared fell outside of the specified tolerance.

  • Unaligned — Signal from the Baseline run did not align with a signal in the Compare to run.

  • Empty — Aligned Baseline or Compare to signal contains no data.

  • EmptySynced — Synchronized Baseline or Compare to signal contains no data.

  • Canceled — Signal result not computed because the user canceled the comparison or the algorithm ended the comparison before computing this signal result.

  • Pending — Comparison is in progress and the signal result computation has not started.

  • Processing — Signal result computation in progress.

  • UnitsMismatchBaseline and Compare to signal units do not match.

  • Unsupported — Simulation Data Inspector comparison algorithm does not support this type of signal. For example, signals with data types that lose precision when converted to double are not supported.

For more information about alignment, tolerances, and synchronization, see How the Simulation Data Inspector Compares Data.

Unique signal identifier for the Baseline comparison signal.

Unique signal identifier for the Compare to comparison signal.

Maximum difference between the two comparison signals.

Synchronized Baseline signal. For more information about synchronization, see How the Simulation Data Inspector Compares Data.

Synchronized Compare to signal. For more information about synchronization, see How the Simulation Data Inspector Compares Data.

Difference signal resulting from the comparison as a timeseries object.

Copy Semantics

Handle. To learn how handle classes affect copy operations, see Copying Objects (MATLAB).


collapse all

This example uses the slexAircraftExample model to demonstrate the comparison of the input and output signals for a control system. The example marks the signals for streaming then gets the run object for a simulation run. Signal IDs from the run object specify the signals to be compared.

% Load model slexAircraftExample and mark signals for streaming
Simulink.sdi.markSignalForStreaming('slexAircraftExample/Aircraft Dynamics Model',4,'on')

% Simulate model slexAircraftExample
out = sim('slexAircraftExample');

% Get run IDs for most recent run
allIDs = Simulink.sdi.getAllRunIDs;
runID = allIDs(end);

% Get Run object
aircraftRun = Simulink.sdi.getRun(runID);

% Get signal IDs
signalID1 = getSignalIDByIndex(aircraftRun,1);
signalID2 = getSignalIDByIndex(aircraftRun,2);

if (isValidSignalID(aircraftRun,signalID1))
    % Change signal tolerance
    signal1 = Simulink.sdi.getSignal(signalID1);
    signal1.AbsTol = 0.1;

if (isValidSignalID(aircraftRun,signalID1) && isValidSignalID(aircraftRun,signalID2))
    % Compare signals
    sigDiff = Simulink.sdi.compareSignals(signalID1,signalID2);

    % Check whether signal result status
    match = sigDiff.Status
match = 


You can view and inspect comparison results using the Simulation Data Inspector UI. For more information, see Compare Simulation Data.

Introduced in R2012b