Limit the Size of Logged Data
Logging simulation data can produce large amounts of data that fill up disk space. Such situations include logging many signals, logging data for long simulations, and running many simulations without deleting run data from the Simulation Data Inspector. You can choose among several options to limit the size of logged simulation data. You can:
Limit the number of runs retained in the Simulation Data Inspector archive.
Reduce the number of data points logged in each simulation.
Specify a minimum disk space requirement or maximum size for logged data.
Configure logging for only viewing data during simulation.
Depending on your requirements, you can use more than one strategy to limit the size of logged data.
Limit the Number of Runs Retained in the Simulation Data Inspector Archive
When you run multiple simulations in a single MATLAB® session, logged simulation data accumulates in the Simulation Data Inspector even if you overwrite the logging data in the MATLAB workspace. To reduce the amount of data the Simulation Data Inspector retains, you can configure a limit for the number of runs stored in the archive. When the number of runs in the archive reaches the size limit, the Simulation Data Inspector starts to delete runs from the archive on a first-in, first-out basis.
Configure the archive Size setting in the Simulation Data Inspector preferences. The size limit only applies to runs in the archive. For the Simulation Data Inspector to automatically limit data retention, select Automatically archive and specify the maximum number of runs to retain in the archive. By default, Automatically archive is enabled with an archive size limit of twenty runs. If you experience issues with logged data consuming too much disk space, consider adjusting the size limit for the archive in the Simulation Data Inspector preferences.
Specify a Minimum Disk Space Requirement or Maximum Size for Logged Data
You can use preferences in the Simulation Data Inspector to directly limit the size of logged
data by specifying a minimum amount of disk space to leave free or by specifying a
maximum size for logged data on disk. Each setting accounts for all kinds of logged
data. By default, logged data must leave at least 100 MB of free disk space with no
maximum size limit. Specify the required disk space and maximum size in GB, and specify
0
to apply no disk space requirement or no maximum size
limit.
When you specify a minimum disk space requirement or a maximum size for logged data, you can also specify whether to prioritize retaining data from the current simulation or data from prior simulations when approaching the limit. By default, the Simulation Data Inspector prioritizes retaining data for the current run. As the free disk space or logged data size approaches the limit, prior runs are deleted first to free up space for data being logged in the current run. If deleting runs does not free up enough space, recording is disabled. To prioritize retaining prior data, change the When low on disk space setting to Keep prior runs and stop recording. You see a warning message when prior runs are deleted and when recording is disabled. If recording is disabled due to the size of logged data, you need to change the Record Mode back to View and record data to continue logging data, after you have freed up disk space.
View Data Only During Simulation
In some situations, you may want to only view the data for logged signals and not save the values. For example, when using the Simulation Data Inspector to visualize data streaming from hardware, you may only want to view the data live and not record it. You can change the Record mode in the Simulation Data Inspector preferences to View during simulation only so that logged data is not saved and you can still view the data during simulation. The Record mode is reset to View and record data at the start of each MATLAB session.
When you change the Record mode to View during simulation only:
Logged data is not available in the Simulation Data Inspector or workspace after simulation.
You can view data using dashboard blocks, scopes, and the Simulation Data Inspector, but plots clear when you pan or zoom.
You cannot access logged data during simulation using the Simulation Data Inspector programmatic interface.
Reduce the Number of Data Points Logged from Simulation
Model configuration parameters and signal properties allow you to limit the number of data points logged in a simulation. Be sure to carefully consider data requirements when limiting logged data points. Limiting data can skip critical time points, and can lead to aliasing, if your effective sample rate is too low.
You can reduce the number of data points using:
Decimation — Log every nth signal value.
Limit data points to last — Only log the last n signal values.
Logging intervals — Specify specific time intervals in which to log data.
For details, see Specify Signal Values to Log.