The MEMORY function returns the amount of RAM memory that the operating system thinks that MATLAB is using. However, the actual memory usage in MATLAB may be different. What this means is that the additional memory, which is 35 GB int this case is probably still available for use by creating arrays in MATLAB.
In order to confirm this, after running your memory consuming code, please try to allocate random array as shown below.
>> a=rand(100000,10000);
Please check if the above command causes an increase in memory used by MATLAB using the MATLAB command. It is expected that you will not see an increase in the memory usage.
Best Answer