Main Content

Simulink.sdi.setDeleteRunsOnLowSpace

Specify behavior when logged data size approaches configured limits

    Description

    example

    Simulink.sdi.setDeleteRunsOnLowSpace(deleteRuns) configures the action to take when the size of logged data approaches the configured maximum size or minimum free disk space requirement. When deleteRuns is true, logged data from prior simulations is deleted first to free space for continued logging in the current simulation. If deleting prior simulation data does not free enough disk space to continue logging through the end of the current simulation, recording data is disabled. When deleteRuns is false, recording data from the current simulation is disabled and no logged data from prior simulations is deleted.

    Examples

    collapse all

    Logging data from simulation can produce large amounts of data that may fill up disk space. To mitigate issues related to filing disk space, you can specify a minimum disk space requirement, a maximum size for logged data, or both. To ensure the logged data does not exceed the specified maximum size or use enough disk space to violate the disk space requirement, prior run data may be deleted and recording logged data may be disabled. You can specify whether to prioritize continuing to log data in the current simulation or retaining prior simulation data.

    Use the Simulink.sdi.setRequiredFreeSpace function to configure logging to leave at least 1 GB of disk space empty.

    Simulink.sdi.setRequiredFreeSpace(1);

    Use the Simulink.sdi.setMaxDiskUsage function to specify a maximum logged data size of 100 GB.

    Simulink.sdi.setMaxDiskUsage(100);

    When you configure logging size limits, you can also specify what to do when the logging limits are approached. You can choose whether to prioritize retaining data from prior runs or data in the current run.

    By default, current simulation data is prioritized. If the size of logged data approaches configured limits, data from prior simulations is deleted. If deleting run data does not free enough space, recording logged data is disabled and no more data from the current simulation is saved. When you choose to prioritize logged data from prior simulations instead, recording is disabled as soon as the size of logged data approaches configured limits. You see a warning when run data is deleted and when recording is disabled.

    Use the Simulink.sdi.setDeleteRunsOnLowSpace function to configure logging to prioritize retaining prior run data.

    Simulink.sdi.setDeleteRunsOnLowSpace(false);

    If recording is disabled due to the size of logged data, you need to enable recording again to save data from future simulations. Use the Simulink.sdi.setRecordData function to enable recording.

    Simulink.sdi.setRecordData(true);

    Input Arguments

    collapse all

    Behavior when logged data size approaches configured limits, specified as numeric or logical 1 (true) or 0 (false).

    • true — First delete data logged from prior simulations. If deleting prior simulation data does not free enough space, disable recording data.

    • false — Disable recording data for current simulation. Do not delete prior simulation data.

    When recording is disabled due to configured disk space requirements or logged data size limits, you need to enable recording again to log data in subsequent simulations. You can configure the record mode in the Simulation Data Inspector preferences or using the Simulink.sdi.setRecordData function.

    Data Types: logical

    Introduced in R2021a