Main Content

Simulink.sdi.getRun

R2026b

Access data for Simulation Data Inspector run

Description

run = Simulink.sdi.getRun(runID) returns a Simulink.sdi.Run object that provides access to the data in the run corresponding to the runID. The Simulation Data Inspector assigns run IDs when it creates a run. You can get the run ID for your run using Simulink.sdi.getAllRunIDs or Simulink.sdi.getRunIDByIndex.

example

Examples

collapse all

Get the run IDs for all runs in the Simulation Data Inspector.

runIDs = Simulink.sdi.getAllRunIDs;

Get the Run object for the most recently created run.

runObj = Simulink.sdi.getRun(runIDs(end));

Get the most recently created run.

runObj = Simulink.sdi.Run.getLatest;

Get the first two signals logged in the most recent Simulation Data Inspector run.

sig1 = getSignalByIndex(runObj,1);
sig2 = getSignalByIndex(runObj,2);

To plot signals on separate subplots, set the subplot to 2-by1. Plot the first signal in the upper subplot and plot the second signal in the lower subplot.

Simulink.sdi.setSubPlotLayout(2,1);
plotOnSubPlot(sig1,1,1,true);
plotOnSubPlot(sig2,2,1,true);

Input Arguments

collapse all

Run ID for the run you want a Simulink.sdi.Run object for. The Simulation Data Inspector assigns run IDs when it creates runs. You can get the run ID for a run using Simulink.sdi.getAllRunIDs or Simulink.sdi.getRunIDByIndex.

Output Arguments

collapse all

Simulink.sdi.Run object for the run corresponding to the run ID.

Version History

Introduced in R2011b