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.

7 Working with Scientific Data Formats<br />

stat = hdfsd('endaccess',sds_id);<br />

Step 6: Closing an HDF4 File. After writing data to a data set and closing<br />

the data set, you must also close the HDF4 file. In the HDF4 SD API, you<br />

use the SDend routine. In <strong>MATLAB</strong>, use the hdfsd function, specifying end<br />

as the first argument. As the only other argument, specify a valid HDF4 SD<br />

file identifier, sd_id in this example:<br />

stat = hdfsd('end',sd_id);<br />

You must close access to all the data sets in an HDF4 file before closing it.<br />

Note Closing an HDF4 file executes all the write operations that have been<br />

queued using SDwritedata. As a convenience, the <strong>MATLAB</strong> HDF Utility<br />

API provides a function that can close all open data set and file identifiers<br />

with a single call. See “Using the <strong>MATLAB</strong> HDF4 Utility API” on page 7-70<br />

for more information.<br />

Using the <strong>MATLAB</strong> HDF4 Utility API<br />

In addition to the standard HDF4 APIs, listed in the hdfreference page,<br />

<strong>MATLAB</strong> supports utility functions that are designed to make it easier to use<br />

HDF4 in the <strong>MATLAB</strong> environment.<br />

For example, using the gateway function to the <strong>MATLAB</strong> HDF4 utility API,<br />

hdfml, and specifying the name of the listinfo routine as an argument, you<br />

can view all the currently open HDF4 identifiers. <strong>MATLAB</strong> updates this list<br />

whenever HDF identifiers are created or closed. In the following example<br />

only two identifiers are open.<br />

hdfml('listinfo')<br />

No open RI identifiers<br />

No open GR identifiers<br />

No open grid identifiers<br />

No open grid file identifiers<br />

No open annotation identifiers<br />

No open AN identifiers<br />

Open scientific dataset identifiers:<br />

262144<br />

7-70

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

Saved successfully!

Ooh no, something went wrong!