Documentation

Simulink.sdi.addToRun

Add simulation data to existing run

Syntax

  • signalIDs = Simulink.sdi.addToRun(runID,'base',varName)
    example
  • signalIDs = Simulink.sdi.addToRun(runID,'model',modelNameOrHandle)
    example
  • signalIDs = Simulink.sdi.addToRun(runID,'vars',var)
    example
  • signalIDs = Simulink.sdi.addToRun(runID,'namevalue',dataName,dataValue)
    example

Description

example

signalIDs = Simulink.sdi.addToRun(runID,'base',varName) adds data, varName, from the base workspace to an existing run, specified by runID.

example

signalIDs = Simulink.sdi.addToRun(runID,'model',modelNameOrHandle) adds model simulation data, specified on the Data Import/Export pane of the Configuration Parameters dialog box, to an existing run, specified by runID. Open the model before you use this syntax.

example

signalIDs = Simulink.sdi.addToRun(runID,'vars',var) adds data stored as variables, var, from the calling workspace to an existing run, specified by runID.

example

signalIDs = Simulink.sdi.addToRun(runID,'namevalue',dataName,dataValue) adds simulation data dataValue, to an existing run, specified by runID, and lets you specify a name, dataName, for the data in the run.

Examples

collapse all

Add Simulation Data from Base Workspace

% Configure model "slexAircraftExample" for logging and simulate
simOut = sim('slexAircraftExample','SaveOutput','on','SaveFormat', ...
             'StructureWithTime','ReturnWorkspaceOutputs','on');

% Create a Simulation Data Inspector run
runID = Simulink.sdi.createRun('My Run')

% Add simulation output from the base workspace
Simulink.sdi.addToRun(runID,'base',{'simOut'});

% See the results in Simulation Data Inspector
Simulink.sdi.view;

Add Simulation Data As Specified in a Model

% Open the model
sldemo_absbrake;

Click Run to simulate the model.

% Create a Data Inspector run
runID = Simulink.sdi.createRun('My Run');
Simulink.sdi.addToRun(runID,'model','sldemo_absbrake');
 
% See the results in Simulation Data Inspector
Simulink.sdi.view;

Add Simulation Data by Passing Variables Directly to Simulink.sdi.addToRun

% Configure model "slexAircraftExample" for logging and simulate
simOut = sim('slexAircraftExample','SaveOutput','on','SaveFormat', ...
             'StructureWithTime','ReturnWorkspaceOutputs','on');

% Create a Simulation Data Inspector run
runID = Simulink.sdi.createRun('My Run');
Simulink.sdi.addToRun(runID,'vars',simOut);

% See the results in Simulation Data Inspector
Simulink.sdi.view;

Add Simulation Data and Name the Data

% Configure model "slexAircraftExample" for logging and simulate
simOut = sim('slexAircraftExample','SaveOutput','on', ...
             'SaveFormat','StructureWithTime', ...
             'ReturnWorkspaceOutputs','on');

% Create a Simulation Data Inspector run
runID = Simulink.sdi.createRun('My Run');
% Name simulation output passed to Simulink.sdi.addToRun
Simulink.sdi.addToRun(runID,'namevalue',{'MyData'},{simOut});

% See the results in Simulation Data Inspector
Simulink.sdi.view;

Related Examples

Input Arguments

collapse all

runID — Unique run identifierinteger

Unique number identifying a run in the Simulation Data Inspector, specified as an integer.

varName — Base workspace datacell array

The names of variables in the base workspace, specified as a cell array of strings.

Example: {'simOut'}

modelNameOrHandle — Model namestring

The model name, or a model handle, specified as a string.

Example: 'sldemo_absbrake'

var — Variable datavariable

Data stored as variables. These variables are assumed to be in the calling workspace.

Example: simOut

dataName — Signal data namecall array

Name of the data in the run, specified as a cell array.

Example: {'MyData'}

dataValue — Signal data valuescell array

Values of the signal data, specified as a cell array.

Example: {simOut}

Output Arguments

collapse all

signalIDs — Unique signal identifierarray

Unique signal identifier, returned as an array of integers where each element is a unique ID for a signal added to the run.

Introduced in R2011b

Was this topic helpful?