This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.


Class: Simulink.sdi.DiffRunResult
Package: Simulink.sdi

Return signal comparison result


diffSignalObj = diffRunObj.getResultByIndex(index)


diffSignalObj = diffRunObj.getResultByIndex(index) returns the Simulink.sdi.DiffSignalResult object, diffSignalObj, which contains the comparison results for a signal. diffRunObj is an instance of a Simulink.sdi.DiffRunResult class, which contains an array of signal comparison results, where each element is an instance of a Simulink.sdi.DiffSignalResult class.

Input Arguments

expand all

An index to the array of Simulink.sdi.DiffSignalResult objects contained in a Simulink.sdi.DiffRunResult object, specified as an integer.

Output Arguments

expand all

Results of comparing two signals between simulation runs, returned as a Simulink.sdi.DiffSignalResult object.


expand all

The function Simulink.sdi.compareRuns returns a Simulink.sdi.DiffRunResult object containing the results of the comparison. The Simulink.sdi.DiffRunResult object contains a Simulink.sdi.DiffSignalResult object for each signal comparison between the two simulation runs. diff.getResultByIndex returns the Simulink.sdi.DiffSignalResult object for each signal comparison.

% Configure model "slexAircraftExample" for logging and simulate
simOut = sim('slexAircraftExample','SaveOutput','on',...

% Create a Simulation Data Inspector run, Simulink.sdi.Run,
% from simOut in the base workspace
runID1 = Simulink.sdi.createRun('First Run','namevalue',{'simOut'},{simOut});

% Simulate again
simOut = sim('slexAircraftExample','SaveOutput','on',...
% Create another Data Inspector run and get signal IDs
runID2 = Simulink.sdi.createRun('Second Run','namevalue',{'simOut'},{simOut});

% Compare two runs and get an instance of Simulink.sdi.DiffRunResult
diff = Simulink.sdi.compareRuns(runID1,runID2);

% Get the number of signal comparison results
count = diff.count;

% Iterate over results and display the comparison results
for i=1:count
	diffSignal = diff.getResultByIndex(i);
	signalID1 = diffSignal.signalID1;
	signalID2 = diffSignal.signalID2;
	match = diffSignal.match;

   if match
      disp([num2str(signalID1) ' and ' num2str(signalID2)...
           ' match']);
      disp([num2str(signalID1) ' and ' num2str(signalID2)...
           ' don''t match']);

Introduced in R2012b

Was this topic helpful?