This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

Data Logging Options

When you set the Log simulation data configuration parameter to All or Use local settings, other options in the Data Logging group box become available.

  • Log simulation statistics — Select this check box if you want to access and analyze information on zero crossings during simulation. By default, this check box is not selected and the zero-crossing data is not logged. For more information on using this check box, see Log Simulation Statistics.

  • Record data in Simulation Data Inspector — Use this check box if you want to stream the logged simulation data to Simulation Data Inspector, to be able to view it during simulation. By default, this check box is not selected. For more information on how to configure and use the Simulation Data Inspector, see Inspect and Analyze Simulation Results (Simulink).

  • Open viewer after simulation — Select this check box if you want to open Simscape™ Results Explorer, which is an interactive tool that lets you navigate and plot the simulation data logging results. By default, this check box is not selected. For more information, see About the Simscape Results Explorer.

    If the Record data in Simulation Data Inspector check box is also selected, then the Simulation Data Inspector opens instead of the Simscape Results Explorer.

  • 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 check box in conjunction with the Data history (last N steps) parameter to limit the number of data points saved. The check box 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 check box 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 10,000 time steps in the simulation.

Another way to reduce memory consumption is to enable data streaming to disk, as described in Stream Logging Data to Disk.

Note

The Output options parameter, under Additional parameters on the Data Import/Export pane of the Configuration Parameters dialog box, also affects which data points are logged. For more information, see Model Configuration Parameters: Data Import/Export (Simulink).

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

Related Examples

More About