How can I make the HDF5READ and HDF5INFO functions in MATLAB 7.6 (R2008a) compatible with my code written in earlier versions of MATLAB?

1 view (last 30 days)
I have used HDF5READ and HDF5INFO functions in earlier versions of MATLAB, prior to MATLAB 7.2 (R2006a).
hinfo = hdf5info('example.h5');
dset = hdf5read( hinfo.GroupHierarchy.Groups(2).Datasets(1));
Now I am using MATLAB R2008a and the HDF5READ and HDF5INFO function do not work correctly.

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 27 Jun 2009
There has been a change made to the HDF5READ and HDF5INFO functions in MATLAB 7.2 (R2006a). To make your older code compatible with the newer version of MATLAB call the HDF5READ and HDF5INFO functions with the 'V71Dimensions' option set to true. If 'V71Dimensions' is set to true, HDF5READ (HDF5INFO) permutes the first two dimensions of the data set as it did in earlier releases of MATLAB. This behavior was intended to account for the difference in how HDF5 and MATLAB express array dimensions. HDF5 describes data set dimensions in row-major order; MATLAB stores data in column-major order. However, permuting these dimensions may not correctly reflect the intent of the data and may invalidate metadata. When 'V71Dimensions' is false (the default), the data dimensions correctly reflect the data ordering as it is written in the file --- each dimension in the output variable matches the same dimension in the file.
Consider the following example:
hinfo = hdf5info('example.h5');
dset = hdf5read( hinfo.GroupHierarchy.Groups(2).Datasets(1),'V71Dimensions', true);
The documentation for HDF5READ and HDF5INFO functions can be accessed by executing the following in your MATLAB prompt:
doc hdf5read
doc hdf5info

More Answers (0)

Products


Release

R2008a

Community Treasure Hunt

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

Start Hunting!