Simulation Data Inspector is a useful tool to view or compare the simulation results of Simulink. Compared to the Scope block, the Data Inspector is more flexible to use. However, after a period of time, the .dmr file of Data Inspector may become very large. Large .dmr file will affect the response speed of Data Inspector.

Delete .dmr manually

The size of .dmr file will keep increasing even if the Data Inspector is cleared. The .dmr file locates in the temp folder of MATLAB, which can be found by getenv('TEMP') or getenv('TMP') on Windows.

The .dmr file is removable only when MATLAB is not running or the file haven’t been used by a running MATLAB instance yet. Otherwise, you have to close the MATLAB first. Then, delete the .dmr manually or restart the MATLAB and use the following command.

delete([getenv('TEMP'),'*.dmr']);
delete([getenv('TMP'),'*.dmr']);

Clear .dmr programmatically

Not long ago, I found a much more convenient way to clear the .dmr file, i.e., by using the following command:

Simulink.sdi.clear
sdi.Repository.clearRepositoryFile

I saved the above command as clearsdi.m in the path of MATLAB. Each time I wanna do a new simulation, just type clearsdi command in the MATLAB console, the .dmr file (as well as the Data Inspector) will be cleared.

Happy Simulinking.


1 Comment

Avatar

Waseem Iqbal · August 8, 2022 at 17:36

It made my life easier… Thanks dear!

Leave a Reply

Your email address will not be published.