Closed matteosecli closed 4 years ago
As there is no standard way to store complex arrays in HDF5, this provides a new option for saveh5 and loadh5, to be used as saveh5(...,'ComplexFormat',{'myReal','myImag'}) (and similarly for loadh5.
saveh5
loadh5
saveh5(...,'ComplexFormat',{'myReal','myImag'})
Example:
myCxMat = randn(4,5)+1i*randn(4,5); saveh5(myCxMat,'myCxMat.h5','ComplexFormat',{'myReal','myImag'}); h5disp('myCxMat.h5'); mySavedData = loadh5('myCxMat.h5','ComplexFormat',{'myReal','myImag'}); isequal(mySavedData.myCxMat,myCxMat)
which should output:
HDF5 myCxMat.h5 Group '/' Dataset 'myCxMat' Size: 4x5 MaxSize: 4x5 Datatype: H5T_COMPOUND Member 'myReal': H5T_IEEE_F64LE (double) Member 'myImag': H5T_IEEE_F64LE (double) ChunkSize: [] Filters: none FillValue: H5T_COMPOUND ans = logical 1
looks great! thanks, accepted.
As there is no standard way to store complex arrays in HDF5, this provides a new option for
saveh5
andloadh5
, to be used assaveh5(...,'ComplexFormat',{'myReal','myImag'})
(and similarly forloadh5
.Example:
which should output: