Main Content


Get names of all elements in referenced Simulation Data Inspector run



names = getElementNames(dsr) returns a cell array containing the names of all top-level elements in the Simulation Data Inspector run referenced by the Simulink.sdi.DatasetRef object dsr.


collapse all

You can plot data from a Simulation Data Inspector run referenced by a Simulink.sdi.DatasetRef object in the Simulation Data Inspector programmatically.

Simulate the model ex_sldemo_absbrake to create a run of logged signals.

mdl = "ex_sldemo_absbrake";

Use the Simulink.sdi.Run.getLatest function to get the latest run.

brakeRun = Simulink.sdi.Run.getLatest;

Create a Simulink.sdi.DatasetRef object that references the run.

runID = brakeRun.ID;
DSRef = Simulink.sdi.DatasetRef(runID);

Get the names of the elements in the referenced run.

names = getElementNames(DSRef)
names = 2x1 cell
    {'slp' }

Use the getSignal function to get the yout bus. You can access the elements of the bus using the Values parameter.

yout = getSignal(DSRef,1);
outputs = yout.Values
outputs = struct with fields:
    Ww: [1x1 timeseries]
    Vs: [1x1 timeseries]
    Sd: [1x1 timeseries]

Use the getSignal function to get the slp signal. Set the Checked property to true to select the signal for plotting in the Simulation Data Inspector.

slp = getSignal(DSRef,"slp");
slp.Checked = 'true';

Open the Simulation Data Inspector to view signals.


Input Arguments

collapse all

Simulation Data Inspector run, specified as a Simulink.sdi.DatasetRef object.

Version History

Introduced in R2017b