How can I write and read logical data types to my HDF5 data file in MATLAB 7.8 (R2009a)?
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
I am using HDF5 low-level functions to write data to an HDF5 file. I would like to save my MATLAB LOGICAL array to HDF5. I have tried using the following code:
fid = H5F.create('myhdf5.h5','H5F_ACC_TRUNC','H5P_DEFAULT','H5P_DEFAULT');
dspace = H5S.create_simple(1,10,10);
dset = H5D.create(fid,'BoolTest','H5T_NATIVE_HBOOL',dspace,'H5P_DEFAULT');
H5D.write(dset,'H5T_NATIVE_HBOOL','H5S_ALL','H5S_ALL','H5P_DEFAULT',rand(10,1));
H5D.close(dset);
H5S.close(dspace);
H5F.close(fid)
However this fails with the error:
??? Error using ==> hdf5lib2
Incorrect type of array passed
to H5D.write in conjunction with
the specified memory datatype.
Error in ==> H5D.write at 37
H5ML.hdf5lib2('H5Dwrite',
varargin{:});
Akzeptierte Antwort
MathWorks Support Team
am 27 Jun. 2009
HDF5 1.8.x does not support a boolean datatype. To work around this, use an integer type and interpret your data according to your rules.
For more information see the HDF5 FAQ by doing an internet search for: "HDF5 faq boolean".
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu HDF5 finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!