Main Content

plot

Open Simulation Data Inspector to view and compare data

Syntax

Description

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.

example

Examples

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";
sim(mdl)

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
    {'yout'}
    {'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.

plot(DSRef)

Input Arguments

collapse all

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

Alternatives

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