Documentation

Simulink.sdi.getSource

Return repository location for storing simulation data

Syntax

  • source = Simulink.sdi.getSource
    example

Description

example

source = Simulink.sdi.getSource returns the location of the Simulation Data Inspector repository for storing simulation data.

Call this function before running multiple simulations in a parfor loop.

Examples

collapse all

Record Data During Parallel Simulations

This example shows how to run parallel simulations using a parfor loop and record each run in the Simulation Data Inspector.

Open the Simulation Data Inspector.

Simulink.sdi.view;

Load the model.

mdl = 'sldemo_absbrake';
load_system(mdl);

Log signals to the Simulation Data Inspector.

set_param(mdl,'InspectSignalLogs','on');

Start a parallel pool with four workers.

myPool = parpool(4);

Run the simulation in a parfor loop.

parfor idx = 1:4
   % Run the simulation
   simOut = sim(mdl,'SaveOutput','on',...
                'SaveFormat','StructureWithTime',...
                'ReturnWorkspaceOutputs','on');
   % Create a simulation run in the Simulation Data Inspector
   Simulink.sdi.createRun(['Run' num2str(idx)],'namevalue',...
                          {'simout'},{simOut});
end

Delete the current parallel pool and close the model.

delete(myPool);
bdclose all;

Import the data from the parallel pool into the Simulation Data Inspector.

Simulink.sdi.importDataFromPriorSessions;

Related Examples

Output Arguments

collapse all

source — Repository locationstring

Location of the Simulation Data Inspector repository, returned as a string.

Introduced in R2012a

Was this topic helpful?