23.06.2015 Views

MATLAB Programming

MATLAB Programming

MATLAB Programming

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Hierarchical Data Format (HDF5) Files<br />

By examining the structures at each level of the hierarchy, you can traverse<br />

the entire file. The following figure describes the complete hierarchical<br />

organization of the sample file example.h5.<br />

Hierarchical Structure of example.h5 HDF5 File<br />

Importing Data from an HDF5 File<br />

To read data or metadata from an HDF5 file, use the hdf5read function. As<br />

arguments, you must specify the name of the HDF5 file and the name of<br />

the data set or attribute. Alternatively, you can specify just the field in the<br />

structure returned by hdf5info that contains the name of the data set or<br />

attribute; hdf5read can determine the file name from the Filename field in<br />

the structure. For more information about finding the name of a data set or<br />

attribute in an HDF5 file, see “Determining the Contents of an HDF5 File”<br />

on page 7-12.<br />

To illustrate, this example reads the data set, /g2/dset2.1 from the HDF5<br />

sample file example.h5.<br />

data = hdf5read('example.h5','/g2/dset2.1');<br />

7-15

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!