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 (HDF4) Files<br />

This example returns information about a sample HDF4 file included with<br />

<strong>MATLAB</strong>:<br />

info = hdfinfo('example.hdf')<br />

info =<br />

Filename: 'example.hdf'<br />

SDS: [1x1 struct]<br />

Vdata: [1x1 struct]<br />

To get information about the data sets stored in the file, look at the SDS field.<br />

Using hdfread to Import Data from an HDF4 File<br />

To use thehdfread function, you must specify the data set that you want to<br />

read. You can specify the filename and the data set name as arguments, or<br />

you can specify a structure returned by the hdfinfo function that contains<br />

this information. The following example shows both methods. For information<br />

about how to import a subset of the data in a data set, see “Reading a Subset<br />

of the Data in a Data Set” on page 7-55.<br />

1 Determine the names of data sets in the HDF4 file, using the hdfinfo<br />

function.<br />

info = hdfinfo('example.hdf')<br />

info =<br />

Filename: 'example.hdf'<br />

SDS: [1x1 struct]<br />

Vdata: [1x1 struct]<br />

To determine the names and other information about the data sets in<br />

the file, look at the contents of the SDS field. The Name field in the SDS<br />

structuregivesthenameofthedataset.<br />

dsets = info.SDS<br />

dsets =<br />

7-53

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

Saved successfully!

Ooh no, something went wrong!