user297850
user297850

Reputation: 8015

issues of saving a large scale matrix to mat file

I was trying to save a matrix into a mat file, but the Matlab returns the following messages:

Warning: Variable 'listmatrix' cannot be saved to a MAT-file whose version is older than 7.3. To save this variable, use the -v7.3 switch. Skipping...

What does it mean for "use the -v7.3 switch"?

Should I use

save testresult.mat -v7.3 listmatrix

or sth else?

Upvotes: 4

Views: 5184

Answers (2)

2one
2one

Reputation: 1085

Hi i thought I’d reply to this thread as I’ve been trying to figure out how to save a large (>2 GB) .mat file in matlab v7 (v7.1.0.183) (R14) and finally found a solution.

If you try to use the save command you will get the following error:

save('test.mat', 'data');

Warning: Variable 'data' cannot be saved to a MAT-file because its storage requirements exceed 2^31 bytes. This limitation will be addressed in a future release. Consider storing this variable in HDF5 file format (see HDF5WRITE). Skipping...

The solution is to write a HDF5 file instead:

hdf5write('test.hdf5', '/dataset1', data);

You can then read the data back into matlab using:

hdf5read('test.hdf5', '/dataset1');

Upvotes: 4

Memming
Memming

Reputation: 1739

A quick google search says yes. Try

save -v7.3 testresult.mat listmatrix

How big is your object? (Do whos listmatrix) You could potentially save memory by using different data type such as uint8.

Upvotes: 2

Related Questions