Simulink archive 2018a

1 vue (au cours des 30 derniers jours)
Victor Portillo
Victor Portillo le 13 Sep 2021
Réponse apportée : Riya le 25 Jan 2024
I see that the function "Simulink.sdi.setAutoArchiveMode" was introduced in 2018b. Is there any work around that could achieve similar functionality for 2018a? The functionality is to eliminate or at least reduce the number of .dmr files generated and stored in the directory returned by the command "tempdir"

Réponses (1)

Riya
Riya le 25 Jan 2024
Hi,
In MATLAB R2018a, the `Simulink.sdi.setAutoArchiveMode` function is not available, as it was introduced in R2018b. However, you can work around this by managing the Signal Data Inspector (SDI) files manually or by using a custom script to clean up the `.dmr` files periodically.
Here's a general approach you can take to manage the `.dmr` files in MATLAB R2018a:
  • Manually Delete `.dmr` Files
dmrFiles = dir(fullfile(tempdir, '*.dmr'));
for k = 1:length(dmrFiles)
delete(fullfile(tempdir, dmrFiles(k).name));
end
  • Create a Cleanup Function
function cleanupDMRFiles()
dmrFiles = dir(fullfile(tempdir, '*.dmr'));
for k = 1:length(dmrFiles)
delete(fullfile(tempdir, dmrFiles(k).name));
end
end
Call this function whenever you want to clear the `.dmr` files.
  • Automate Cleanup with a Timer
If you want to automate this process, you can create a MATLAB timer object that periodically runs the cleanup function.
cleanupTimer = timer('ExecutionMode', 'fixedSpacing', ...
'Period', 3600, ... % Run every hour
'TimerFcn', @(~,~)cleanupDMRFiles());
start(cleanupTimer);
Remember to stop and delete the timer when you no longer need it.
stop(cleanupTimer);
delete(cleanupTimer);
If you have control over how the simulations are run, you might be able to reduce the number of `.dmr` files by changing how often data is logged or by disabling logging for certain signals.
These workarounds are manual and not as convenient as the `setAutoArchiveMode` function introduced in R2018b, but they can help you manage the `.dmr` files in R2018a. If upgrading to a newer version of MATLAB is an option, that would be the best solution to access the new functionality.

Produits


Version

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by