| Contents | Index |
| On this page… |
|---|
When reusing data from a variable step size simulation for simulation in another model, the second simulation must read the data at the same time steps as the first simulation.
The following example illustrates how to reuse signal logging data from the simulation of one model in a second model. For more information, see Importing Signal Logging Data.
Open the ex_data_import_continuous model.

This model uses the ode15s solver and produces continuous signals.
To use the output of this model as input to the simulation of another model, log the signal that you want to reuse. Select the Signal Properties > Log signal data.
Simulate the model.
Simulating the model saves a variable-step signal to the workspace, using the logsout variable. The signal logging ouput is a Simulink.SimulationData.Dataset object.
Use the Simulink.SimulationData.Dataset.getElement method to access the logged data. The logging data for individual signals is stored in Simulink.SimulationData.Signal objects. For this model, there is one logged signal: StepResponse.
Open a second model, named ex_data_import_continuous_second.

You can configure this second model to simulate using the logged data from the first model. In this example, the second model uses a root-level Inport block to import the logged data. The Inport block has the Interpolate data option selected.
In the second model, select the Configuration Parameters > Data Import/Export > Input parameter.
Use the Simulink.SimulationData.Signal.getElement method to specify the StepResponse signal element, as shown below:

Specify that for the second model, the Simulink solver runs at the time steps specified in the saved data (u). In the Data Import/Export pane, set the Output options parameter to Produce additional output and the Output times parameter to:
logsout.getElement('StepResponse').Values.TimeSimulate the second model.
Note Simulink does not feed minor time-step data through root input ports. For details about minor time steps, see Minor Time Steps. |
![]() | Importing Signal Data in Simulink | Importing Data to Test a Discrete Algorithm | ![]() |

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 |