Error writing array of class double to a HDF5 file
Show older comments
Hi
I am having trouble with the following code:
data = zeros(100);
for i = 1:100
for j = 1:100
data(i, j) = rand(1,1) + 1i*rand(1,1);
end
end
h5create("test.h5", "/test", size(data));
h5write("test.h5", "/test", data);
I am trying to write data of class double to a hdf5 file which I create but I recieve the following error
Warning: Conversion from double to datatype H5T_NATIVE_DOUBLE may clamp some values.
> In H5D.write (line 100)
In h5write (line 138)
Error using hdf5lib2
The class of input data must be double instead of double when the HDF5 class is H5T_IEEE_F64LE.
Error in H5D.write (line 100)
H5ML.hdf5lib2('H5Dwrite', varargin{:});
Error in h5write (line 138)
H5D.write(dataset_id,'H5ML_DEFAULT',memspace_id,filespace_id,dxpl,Data);
I have tried specifying the datatype when I create the hdf5 file but I recieve the same error message
h5create("test.h5", "/test", size(data), 'Datatype','double');
h5write("test.h5", "/test", data);
Thanks in advance
Accepted Answer
More Answers (0)
Categories
Find more on HDF5 in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!