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.

Limit Amount of Exported Data

You can use several options to reduce the amount of data logged during a simulation. Limiting the amount of exported simulation data reduces memory usage and speeds up simulation. However, if you limit the amount of simulation data, the logged data can skip some time steps that are critical for testing and analyzing the model.

You can use multiple techniques for the same simulation.

TechniqueDescription
Specify a decimation factorSkip samples when exporting data.
Limit data pointsLimit the number of samples saved to be only the most recent samples
Specify an interval for loggingSpecify ranges of time steps for logging

Alternatively, for logging large amounts of data that can cause memory issues, consider logging to persistent storage. This approach preserves all the logging data, minimizing MATLAB workspace memory usage. For details, see Log Data to Persistent Storage.

Decimation

To skip samples when exporting data, apply a decimation factor. For example, a decimation factor of 2 saves every other sample. By default, decimation is set to 1, which does not skip any samples.

The approach you use to specify a decimation factor depends on the kind of logging data.

DataHow to Specify
Signal loggingRight-click the signal. In the Signal Properties dialog box, select the Decimation parameter.
Data store loggingFrom the Block Parameters dialog box for that block, open the Logging tab. Apply a decimation factor using the Decimation parameter.
State and output

Enter a value in the field to the right of the Decimation label.

Limit Data Points

To limit the number of samples saved to be only the most recent samples, set the Limit Data Points parameter.

The approach you use depends on the kind of logging data.

DataHow to Specify

Signal logging

Right-click the signal. In the Signal Properties dialog box, select the Limit Data Points to Last parameter.

Data store logging

From the Block Parameters dialog box for that block, open the Logging tab. Select the Limit Data Points to Last parameter.

Time, state, and output logging

Select the Limit data points configuration parameter and for the Maximum number of data points configuration parameter, specify the limit.

Logging Intervals

To specify an interval for logging, use the Configuration Parameters > Data Import/Export > Logging intervals parameter. Limiting logging to a specified interval allows you to examine specific logged data without changing the model or adding complexity to a model.

The logging intervals apply to data logged for:

  • Time

  • States

  • Output

  • Signal logging

  • The To Workspace block

  • The To File block

The logging intervals do not apply to final state logged data, scopes, or streaming data to the Simulation Data Inspector.

The intervals specified with Logging intervals establish the set of times to which the Decimation and Limit data points to last parameters apply. For example, suppose that you set the logging interval [2,4;7,9] with a fixed-step solver with a fixed-step size of 1. The logged times are 2, 3, 4, 7, 8, and 9.

Related Examples

More About