Main Content

Simulink.sdi.createRunOrAddToStreamedRun

R2026b

Create a single run for all simulation outputs

Description

runID = Simulink.sdi.createRunOrAddToStreamedRun(mdl,runName,varSources,varValues) adds data to the most recent Simulation Data Inspector run associated with the model mdl. If no run exists in the Simulation Data Inspector repository for the model mdl, the function creates a new run.

You can use Simulink.sdi.createRunOrAddToStreamedRun to add output and state data logged in Structure with Time format to a run without creating new runs or duplicating signals in the Simulation Data Inspector. When you use Simulink.sdi.createRun, the Simulation Data Inspector creates a new run. When you use Simulink.sdi.addToRun, the Simulation Data Inspector imports a duplicate the signal. To include all simulation data in a single run with no redundancy, use Simulink.sdi.createRunOrAddToStreamedRun.

example

Examples

collapse all

Suppose you simulate a model that logs outputs and states in Structure with Time format. When output and state data is saved in Structure with Time format, the software does not stream data to the Simulation Data Inspector. To add the state and output data to the most recent run of the model, use Simulink.sdi.createRunOrAddToStreamedRun.

runID = Simulink.sdi.createRunOrAddToStreamedRun(...
    "MyModel","My Run",{'output','states'},{out.yout,out.xout})

Input Arguments

collapse all

Name of the model that data generated from, specified as a string or character vector.

Example: "MyModel"

Run name for the new or augmented run, specified as a string or character vector. If Simulink.sdi.createRunOrAddToStreamedRun adds data to an existing run, the run is renamed according to runName.

Example: "My Run 1"

Names for data sources in varValues, specified as a string, character vector or a cell array of character vectors.

Example: {'sig1','sig2'}

Data to add to run, specified as a cell array. Simulink.sdi.createRunOrAddToStreamedRun supports data in all logging and loading formats, including timeseries and Simulink.SimulationData.Dataset.

Example: {sig1,sig2}

Output Arguments

collapse all

Run identifier for the new or augmented run, returned as a positive integer.

Version History

Introduced in R2017a