Skip to Main Content Skip to Search
Product Documentation

How to Log Simulation Data

How to Enable Data Logging

By default, simulation data is not logged. To turn on the data logging for a model, use the Log simulation data configuration parameter.

  1. In the model window, from the top menu bar, select Simulation > Configuration Parameters. The Configuration Parameters dialog box opens.

  2. In the Configuration Parameters dialog box, in the left pane, select Simscape. The right pane displays the Log simulation data option, which is set to none, by default.

  3. From the drop-down list, select all, then click OK.

  4. Simulate the model. This creates a workspace variable named simlog (as specified by the Workspace variable name parameter), which contains the simulation data.

For information on how to access and use the data stored in this variable, see Data Logging Example.

Data Logging Options

When you set the Log simulation data configuration parameter to all, other options in the Data Logging group box become available.

Saving data to the workspace can slow down the simulation and consume memory. To avoid this, you can use either the Decimation parameter, or Limit data points in conjunction with Data history (last N steps), or both methods, to limit the number of data points saved. The two methods work independently from each other and can be used separately or together. For example, if you specify a decimation factor of 2 and keep the default value of 5000 for the Data history (last N steps) parameter, your workspace variable will contain downsampled data from the last 10000 time steps in the simulation.

After changing your data logging preferences, rerun the simulation to generate a new data log.

  


Related Products & Applications

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