Class: Simulink.sdi.DatasetRef
Package: Simulink.sdi

Retrieve DatasetRef element by index


[element, name, index] = SDIdatasetRef.getElement(index)


[element, name, index] = SDIdatasetRef.getElement(index) returns the element within the Run in the Simulink.sdi.DatasetRef object at the specified index.

Input Arguments

expand all

Location of the element in the Simulink.sdi.DatasetRef object.

Output Arguments

expand all

Element from the run in the Simulink.sdi.DatasetRef object.

Name of the element retrieved from the Simulink.sdi.DatasetRef object.

Location of the element within the Simulink.sdi.DatasetRef object.


expand all

This example shows how to work with the Simulink.sdi.DatasetRef object by comparing two runs of the ex_sldemo_absbrake system with different desired slip ratios.

% Simulate model ex_sldemo_absbrake to create a run of logged signals

% Get the runID
runIDs = Simulink.sdi.getAllRunIDs;
runID = runIDs(end);

% Get the run object
brakeRun = Simulink.sdi.getRun(runID);

% Make a Simulink.sdi.DatasetRef object
run_DSRef = brakeRun.getDatasetRef;

% Get the names of the elements in the object
names = run_DSRef.getElementNames
names = 2x1 cell
    {'slp' }

% Get yout bus
[yout, name, index] = run_DSRef.getElement(1);

% View signals in outputs
outputs = yout.Values
outputs = struct with fields:
    Ww: [1x1 timeseries]
    Vs: [1x1 timeseries]
    Sd: [1x1 timeseries]

% Get slp signal
slp = run_DSRef.getSignal('slp');

% Plot signal
slp.Checked = 'true';
% Create another run for a different Desired relative slip
set_param('ex_sldemo_absbrake/Desired relative slip', 'Value', '0.25')
DSR_Runs = Simulink.sdi.DatasetRef;

% Compare the results from the two runs
[matches, mismatches, diffResult] =;

% Open the Simulation Data Inspector to view signals
Introduced in R2017b