MATLAB: Best way to save big matrices

file format cdf save matrix

I'm looking for the best way to save big (both full and sparse) matrices in files. What I need to be able to do is:
– Read only certain entries from the file (certain matrix entries, that is)
– Create a sparse matrix in MATLAB from this file without creating a full matrix first (assuming the file contains a sparse matrix, of course)
The reason is quite simple: The nonsparse matrices will be too big to be stored into memory as a full matrix.
I read about the CDF file format which I'm not yet familiar with, so I don't know if it's possible to create a sparse matrix in Matlab from a CDF File?

Best Answer

  • The most recent versions of MATLAB have the matfile() command, which I believe does at least some of what you want.