| Contents | Index |
signalIDs = Simulink.sdi.addToRun(runID,'base',{varName1,...,varNameN})
signalIDs = Simulink.sdi.addToRun(runID,'model',modelNameOrHandle)
signalIDs = Simulink.sdi.addToRun(runID,'vars',var1,...,varN)
signalIDs = Simulink.sdi.addToRun(runID,'namevalue',{Name1,...,NameN},{Value1,...,ValueN})
signalIDs = Simulink.sdi.addToRun(runID,'base',{varName1,...,varNameN}) creates a run with data from the base workspace. {var1Name,...,var2Name} is a cell array of strings, which are the names of variables in the base workspace.
signalIDs = Simulink.sdi.addToRun(runID,'model',modelNameOrHandle) creates a run with the model simulation data, as specified on the Data Import/Export pane of the Configuration Parameters dialog box. modelNameOrHandle is a string, specifying the model name, or a model handle. When calling this function, the model must be open.
signalIDs = Simulink.sdi.addToRun(runID,'vars',var1,...,varN) creates a run with data stored as variables, var1,...,varN. These variables are assumed to be in the calling workspace.
signalIDs = Simulink.sdi.addToRun(runID,'namevalue',{Name1,...,NameN},{Value1,...,ValueN}) creates a run from simulation data, Value1, and provides the ability to specify a name, Name1, for the data in the run.
runID |
Run ID, a unique number identifying a run in the Simulation Data Inspector. |
signalIDs |
Array of numbers where each element is a unique ID for a signal added to the run. |
Add simulation data from the base workspace:
% Configure model "sldemo_f14" for logging and simulate
simOut = sim('sldemo_f14','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:
sldemo_absbrake;
% Run simulation using the Simulink menu or the toolbar.
% 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 "sldemo_f14" for logging and simulate
simOut = sim('sldemo_f14','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 "sldemo_f14" for logging and simulate
simOut = sim('sldemo_f14','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;
Simulink.sdi.createRun | Simulink.sdi.Run | Simulink.sdi.view

Learn more about Simulink through this collection of videos, articles, technical literature and the Getting Started with Simulink Guide.
| © 1984-2012- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |