MATLAB: Reading HDF5 data gives byte array instead of larger integers

bytearrayh5h5infoh5readhdf5labviewMATLAB

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?

Best Answer

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.