Main Content


Open Simulation Data Inspector to view and compare data




plot(dsr) opens the Simulation Data Inspector, where you can view and compare runs and signals from 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 to view, specified as a Simulink.sdi.DatasetRef object.


You can use the Simulink.sdi.view function to open the Simulation Data Inspector. For information on opening Simulation Data Inspector in Simulink®, see View Simulation Data in Simulation Data Inspector.

Version History

Introduced in R2017b