Load Data Logged In Another Simulation
A common source of signal data to load into a model is data that you log from a simulation. You can use the signal data captured from a simulation as roundtrip input to:
Simulate the same model again from a known starting point.
Test simulation results.
Simulate another model starting with the captured signal values from a model. For example, you can log signal data when you simulate a model. Then load the signal data from that simulation as inputs to a second model that you want to reference from the first model.
You can capture the signal data from a simulation in a workspace or in a file. Use one of these techniques to capture signal data from a simulation:
To Workspace block
To File block
In the Configuration Parameters > Data Import/Export pane, the Output, States, or Final states parameters
simcommand configured to log simulation data
For an example of using simulation data for roundtrip signal data loading, see Load Data to Model a Continuous Plant.
Load Logged Data
Here is a workflow for using signal logging data for standalone simulation of a
referenced model. You can use a similar approach for other data logged in
Use the default signal logging output variable,
logsout, or specify a variable using the Configuration Parameters > Data Import/Export > Signal logging edit box.
Simulate the parent model.
The signal logging output is a
Simulink.SimulationData.Dataset.getElementmethod to access the logged data. The logging data for individual signals is stored in
For the referenced model that you want to simulate standalone, use the
Simulink.SimulationData.Signal.getElementmethod to specify signal elements for the Configuration Parameters > Data Import/Export > Input parameter.
Simulate the referenced model.
For an example of loading signal logging data for a model that uses model referencing, see Logging Intervals. After you open the model, double-click the blue block labeled Interface Specification and see the sections called:
Logging Model Reference Signals
Also, the Load Data to Model a Continuous Plant example illustrates loading signal logging data.
To import signal logging data for array of buses signals, see Import Array of Buses Data.
Configure Logging to Meet Loading Requirements
Different logging techniques support different data formats. Most logging techniques
Dataset format, which provides a consistent data format for
logged signal data. You can use the
constructor to convert other data
To log only the data that you require, use the Configuration Parameters > Data Import/Export > Logging intervals parameter to specify start and stop time intervals.