How to append data to an existing .mat file without loading the existing data from that mat file in MATLAB?

845 views Asked by At

I have a very huge chunk of data say about 3GB. When I try to load it and save it in a mat file, my laptop hangs as I have only 4GB RAM. Now I figured if I can divide my original data in smaller chunks and do whatever processing i need to do and save it into mat file in steps, it will not take much of RAM. But I couldn't find a way to append new data into the existing mat file without loading the existing data in it (which would fail the purpose).

Any ideas?

1

There are 1 answers

0
Robert Seifert On

Use the function matfile: documentation

m = matfile(filename) creates a MAT-file object, m, connected to the MAT-file named filename. The object allows you to access and change variables directly in a MAT-file, without having to load the variables into memory.

The partial loading and saving that the matfile function provides requires less memory than the load and save commands, which always operate on entire variables.