Reading HDF5 data gives byte array instead of larger integers

1 view (last 30 days)
When I read in an HDF5 file with h5info, some of the value fields are arrays of uint8 instead of what I expect (int32,int64,uint32,etc.). Why does this happen?

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 29 Jan 2016
MATLAB is unable to read 128-bit or larger signed and unsigned integers. Sometimes the data type of a field is set to an incompatible data type so MATLAB instead reads an array of uint8. The data type can be found in the Datatype field of the structure corresponding to the given values. 
If there is an incompatible data type but you expect there to be a different data type (like int64), you should either fix the source of the HDF5 file to export the correct data types or manually convert byte array into an array of the desired format. Some byte rearrangement may be necessary depending on the formats. 
An example MATLAB function is attached that converts from a byte array to an array of int64.

More Answers (0)

Products


Release

R2015b

Community Treasure Hunt

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

Start Hunting!