| Contents | Index |
| On this page… |
|---|
By default, simulation data is not logged. To turn on the data logging for a model, use the Log simulation data configuration parameter.
In the model window, from the top menu bar, select Simulation > Configuration Parameters. The Configuration Parameters dialog box opens.
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.
From the drop-down list, select all, then click OK.

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.
When you set the Log simulation data configuration parameter to all, other options in the Data Logging group box become available.
Workspace variable name — Specifies the name of the workspace variable that stores the simulation data. Subsequent simulations overwrite the data in the simulation log variable. If you want to compare data from two models or two simulation runs, use different names for the respective log variables. The default variable name is simlog.
Decimation — Use this parameter to limit the number of data points saved, by outputting data points for every nth time step, where n is the decimation factor. The default is 1, which means that all points are logged. Specifying a different value results in the first step, and every nth step thereafter, being logged. For example, specifying 2 logs data points for every other time step, while specifying 10 logs data points for just one in ten steps.
Limit data points — Use this checkbox in conjunction with the Data history (last N steps) parameter to limit the number of data points saved. The checkbox is selected by default. If you clear it, the simulation log variable contains the data points for the whole simulation, at the price of slower simulation speed and heavier memory consumption.
Data history (last N steps) — Specify the number of simulation steps to limit the number of data points output to the workspace. The simulation log variable contains the data points corresponding to the last N steps of the simulation, where N is the value that you specify for the Data history (last N steps) parameter. You have to select the Limit data points checkbox to make this parameter available. The default value logs simulation data for the last 5000 steps. You can specify any other positive integer number. If the simulation contains fewer steps than the number specified, the simulation log variable contains the data points for the whole simulation.
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.
![]() | About Simulation Data Logging | Data Logging Example | ![]() |

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 |