Documentation

This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

Simulink.sdi.addToRun

Add data to existing run

Syntax

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

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

% 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;
% 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;
% 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;
% 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;

Input Arguments

collapse all

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

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

Example: {'simOut'}

The model name, or a model handle, specified as a character vector.

Example: 'sldemo_absbrake'

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

Example: simOut

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

Example: {'MyData'}

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

Example: {simOut}

Output Arguments

collapse all

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?