23.06.2015 Views

MATLAB Programming

MATLAB Programming

MATLAB Programming

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Hierarchical Data Format (HDF4) Files<br />

ReadingaSubsetoftheDatainaDataSet. To read a subset of a data<br />

set, you can use the optional 'index' parameter. The value of the index<br />

parameter is a cell array of three vectors that specify the location in the data<br />

set to start reading, the skip interval (e.g., read every other data item), and<br />

the amount of data to read (e.g., the length along each dimension). In HDF4<br />

terminology, these parameters are called the start, stride, andedge values.<br />

For example, this code<br />

• Starts reading data at the third row, third column ([3 3]).<br />

• Reads every element in the array ([]).<br />

• Reads 10 rows and 2 columns ([10 2]).<br />

subset = hdfread('Example.hdf','Example SDS',...<br />

'Index',{[3 3],[],[10 2 ]})<br />

subset =<br />

7 8<br />

8 9<br />

9 10<br />

10 11<br />

11 12<br />

12 13<br />

13 14<br />

14 15<br />

15 16<br />

16 17<br />

Using the HDF4 Low-Level Functions<br />

This section describes how to use <strong>MATLAB</strong> functions to access the HDF4<br />

Application <strong>Programming</strong> Interfaces (APIs). These APIs are libraries of C<br />

routines that you can use to import data from an HDF4 file or export data<br />

from the <strong>MATLAB</strong> workspace into an HDF4 file. To import or export data, you<br />

must use the functions in the HDF4 API associated with the particular HDF4<br />

data type you are working with. Each API has a particular programming<br />

model, that is, a prescribed way to use the routines to write data sets to<br />

the file. To illustrate this concept, this section describes the programming<br />

7-55

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

Saved successfully!

Ooh no, something went wrong!