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.