Main Content

Simulink.sdi.getAllRunIDs

Get all Simulation Data Inspector run identifiers

Description

example

runIDs = Simulink.sdi.getAllRunIDs returns a matrix of the run identifiers for all runs in the Simulation Data Inspector repository.

Examples

collapse all

Many tasks performed using the Simulation Data Inspector programmatic interface start with obtaining the run ID for a simulation run. This example illustrates several methods to get the run ID for a run. You can use the run ID to access the Simulink.sdi.Run object that contains the run data and metadata and perform run comparisons using the Simulink.sdi.compareRuns function.

Create a Run

The model sldemo_fuelsys is already configured for logging. When you simulate the model, the Simulation Data Inspector automatically creates a run and assigns it a run ID.

load_system('sldemo_fuelsys')
sim('sldemo_fuelsys')

Get Run ID Using Simulink.sdi.getAllRunIDs

The Simulink.sdi.getAllRunIDs function returns an array of all run IDs for the runs in the Simulation Data Inspector repository, in order, with the most recently created run at the end.

runIDs = Simulink.sdi.getAllRunIDs;
runID = runIDs(end);

Get Run ID Using Simulink.sdi.getRunIDByIndex

You can also use the Simulink.sdi.getRunCount and Simulink.sdi.getRunIDByIndex functions to get the run ID for a run. This method is useful if you also want to use count as a counting variable to index through the runs in the Simulation Data Inspector repository.

count = Simulink.sdi.getRunCount;
runID = Simulink.sdi.getRunIDByIndex(count);

Get Run ID from a Simulink.sdi.Run Object

You can also get the run ID from the Simulink.sdi.Run object that corresponds to the run. This example uses the Simulink.sdi.getCurrentSimulationRun function to get the Run object that corresponds to the most recent simulation of the sldemo_fuelsys model. You can also use the Simulink.sdi.Run.getLatest function to access the most recently created Run object.

fuelsysRun = Simulink.sdi.getCurrentSimulationRun('sldemo_fuelsys');
runID = fuelsysRun.ID;

Output Arguments

collapse all

Matrix of run IDs in the Simulation Data Inspector repository.

Version History

Introduced in R2017a