clear after save in -v7.3 in script does not free memory
1 view (last 30 days)
Show older comments
Hi,
I run a postprocessing script on data saved from a simulation before feeding it back into another Simulink model. It's a large simulation with a lot of data generated. Since I only have 8Gb of memory, I can't postprocess all the data at once. So I have a script that runs over a smaller part of the data, then saves the step in a file and then moves on to the next part of data. The postprocessed data are timeseries that are later read in by Simulink again. Thus the files must be saved in -v7.3. This is where the problem lies. In the postprocessing file I want to achieve the following:
load datafile datapart_1;
do something on datapart_1;
save altered_datapart_1 altered_datapart_1 -v7.3;
clear datapart_1 altered_datapart_1;
load datafile datapart_2
do something on datapart_2
save altered_datapart_2 altered_datapart_2 -v7.3
clear datapart_2 altered_datapart_2
etc etc....
However, looking at the taskmanager performance monitor, the clear command does nothing while the script is running. Memory keeps filling up and I end up swapping to harddisk as the process progresses to datapart_15!!! My swapfile has grown to 25Gb!!!! I've narrowed it down to the -v7.3 option in the save command preceding the clear. In -v7 or older mode it doesn't happen and memory is freed after every step. However, I can not read it in with the second Simulink model.
Has anybody got a solution to this that does not involve changing anything in the Simulink models I use?
Kind regards,
sjerra
[EDITED, Jan, please format your code - thanks]
5 Comments
Answers (0)
See Also
Categories
Find more on Sources in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!