Saving large matrices WITHOUT hdf5

조회 수: 6 (최근 30일)
Jason Corso
Jason Corso 2014년 4월 28일
댓글: Walter Roberson 2014년 4월 29일
I have a large matrix currently stored in .mat v7.3 format that I need to read into another program. This program can read normal .mat files without problem, but can't handle HDF5 files. This is a problem, since Matlab refuses to save the variable in anything but a -v7.3 file.
How can I force Matlab to save this variable in a non-HDF5 file?

답변 (3개)

Chad Greene
Chad Greene 2014년 4월 28일
A = rand(4,3,2,5);
dlmwrite('mydata.txt',A)

Walter Roberson
Walter Roberson 2014년 4월 28일
What formats are supported by the other program?
You can fwrite() the data as binary. Note that if you fwrite() anything with 2 or more dimensions, the memory is written "down" columns, corresponding to varying the earlier dimensions more rapidly than the later dimensions.

Jason Corso
Jason Corso 2014년 4월 29일
I suppose those are options, but they'd require writing all new I/O code for the other program, which is currently set up quite nicely to read (non-HDF5) .mat files. So really, what I want is to force Matlab to save the matrix to a v7 or earlier .mat file.
  댓글 수: 1
Walter Roberson
Walter Roberson 2014년 4월 29일
If the matrix is 2 Gb or larger (I think it is, 4 Gb max for sure) then there is no way to store it in a v7 .mat file. v7 .mat files include size fields that are limited to 32 bits.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 HDF5에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by