Simulink.sdi.DiffRunResult class

Package: Simulink.sdi

Access run comparison metadata


The Simulink.sdi.DiffRunResult class provides access to the run comparison metadata. You can use the getSignalByIndex method to access the data and comparison results for each signal in the run comparison.


DiffRunResultObj = Simulink.sdi.compareRuns(runID1, runID2) returns a Simulink.sdi.DiffRunResult object to provide access to the comparison results from comparing the runs corresponding to runID1 and runID2.

Input Arguments

expand all

Numeric run identifier for the Baseline run in the comparison.

Numeric identifier for the Compare to run in the comparison.


expand all

Run identifier for the Baseline signal of the comparison.

Run identifier for the Compare to signal of the comparison.

Version of MATLAB® used.

Date and time the Simulink.sdi.DiffRunResult object was created.

Data Types: datetime

Number of signals aligned between the two runs in the comparison. For more information on how signals are aligned for comparisons, see How the Simulation Data Inspector Compares Data.


getResultByIndexReturn signal comparison result

Copy Semantics

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


expand all

You can change tolerance values on a signal-by-signal basis to evaluate the effect of a model parameter change. This example uses the slexAircraftExample model and the Simulation Data Inspector to evaluate the effect of changing the time constant for the low-pass filter following the control input.

% Load example model

% Mark the alpha, rad signal for streaming
Simulink.sdi.markSignalForStreaming('slexAircraftExample/Aircraft Dynamics Model', 4, 'on')

% Simulate system

% Change input filter time constant
modelWorkspace = get_param('slexAircraftExample', 'modelworkspace');
modelWorkspace.assignin('Ts', 0.2)

% Simulate again

% Get run data
runIDs = Simulink.sdi.getAllRunIDs;
runID1 = runIDs(end - 1);
runID2 = runIDs(end);

% Compare runs
diffRun1 = Simulink.sdi.compareRuns(runID1, runID2);

% Get signal result
sigResult1 = diffRun1.getResultByIndex(1);

% Check whether signals matched
ans =



% Get signal object for sigID1
run1 = Simulink.sdi.getRun(runID1);
sigID1 = run1.getSignalIDByIndex(1);
sig1 = Simulink.sdi.getSignal(sigID1);

% Change absolute tolerance to 0.2
sig1.absTol = 0.2;

% Run the comparison again
diffRun2 = Simulink.sdi.compareRuns(runID1, runID2);
sigResult2 = diffRun2.getResultByIndex(1);

% Check the result
ans =




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

Introduced in R2012b

Was this topic helpful?