How to manage and reduce the size of DMR files that MATLAB generates in the temp directory?

155 views (last 30 days)
I am running several Simulink simulations, and I notice that large files with the extension ".dmr" are created in my temporary directory (also called "temp" or "tmp"). Is there a way to control the size of these files and how these files are created?

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 27 Aug 2025
Edited: MathWorks Support Team on 27 Aug 2025

What are DMR files?

DMR files are "Data Model Repository" files. Simulink generates DMR files in the temporary directory to store logged signal data. This includes data from signals marked for logging sent to Simulation Data Inspector (SDI), data logged from output ports, data sent to To Workspace blocks, among other signal logging methods as outlined in the table: Choose Technique to Log Simulation Data.
These files are typically deleted when MATLAB closes. However, if MATLAB is improperly terminated, such as through a forced shutdown or crash, DMR files may remain in the temporary directory. You can safely delete these files from your temporary directory, as explained in the following answer:

Strategies to reduce the size of DMR files:

To manage and reduce the size of the generated DMR files, you can apply several strategies. For detailed guidance, refer to the official documentation: Limit the Size of Logged Data.
Option 1 - Adjust SDI preferences:
The settings related to SDI data management can be found in the SDI Preferences > Storage panel, as shown in the following screenshot:
① Since R2021a, you can limit the size of DMR files by specifying a minimum amount of disk space to leave free using the Required Free Disk Space (GB) setting, or by specifying a maximum size with Max Disc Usage (GB).
② Use the Size setting to control how many runs are retained in the SDI archive. By default, SDI automatically archives and keeps 20 old runs, which can accumulate large data during long MATLAB sessions. The limit only applies to archived runs, so keep the option Automatically archive enabled.
③ To not log to a DMR file at all, set the Record mode to View during simulation only in R2021a and later. Turn recording off only if you don't need any logged data in SDI or the workspace after a simulation run ends. A minimal DMR file (~2MB) is still created, but it will not increase.
NOTE: The Record mode resets to the default View and record data when MATLAB restarts. To set it automatically for every MATLAB session, add the following command to a startup file:
Simulink.sdi.setRecordData(false);
.
Option 2 - Discard logged data for the current SDI session:
When you use the command to clear all data from the SDI, it will also truncate the DMR file for the current SDI session back to ~2MB:
>> Simulink.sdi.clear % To suppress export of data to workspace in R2023a and later, use: >> Simulink.sdi.clear(Export=false)
.
Option 3 - Reduce the amount of logged data:
Lastly, you can reduce the size of the generated DMR files by reducing the amount of logged data. Review your data logging settings in the Model Configuration Parameter: Data Import/Export pane for areas where data is logged which is not needed. You can also limit the data points by using Decimation, Limit Data Points, or Logging Intervals, as explained in Specify Signal Values to Log. To reduce the number of logged signals temporarily for a set of runs, consider using the Data Logging Override options. Note that data logging overrides can be changed and applied to a model in accelerator mode without requiring rebuilding the model.

More Answers (0)

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!