MATLAB: MATLAB uses significantly more RAM than the .mat-file size when loaded

loadmemory usageram

Hi everyone, I'm using MATLAB R2018a on Ubuntu 17.1 system. I have 16GB of RAM and 32GB of swap area. I have a large .mat file (5.8 GB when clicking on 'Properties') that I need to analyze, but when I load it into MATLAB it uses all my RAM and ~3GB of swap. I suppose that these values does not necessarily match, but I think that such a huge difference is not usual, and it does not let me run my code without taking a lot of time. Any clue of what determines these memory file-size and usage differences? Is it possible to change them? Thanks in advance

Best Answer

MAT files can contain compressed data, which are decompressed during loading. So this is the expected behavior.
See doc save (link), especially the "version" argument.