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.

7 Working with Scientific Data Formats<br />

The return value contains the values in the data set, in this case a 1-by-10<br />

vector of single-precision values:<br />

data =<br />

1.0000<br />

1.1000<br />

1.2000<br />

1.3000<br />

1.4000<br />

1.5000<br />

1.6000<br />

1.7000<br />

1.8000<br />

1.9000<br />

The hdf5read function maps HDF5 data types to appropriate <strong>MATLAB</strong> data<br />

types, whenever possible. If the HDF5 file contains data types that cannot<br />

be represented in <strong>MATLAB</strong>, hdf5write uses one of the predefined <strong>MATLAB</strong><br />

HDF5 data type objects to represent the data.<br />

For example, if an HDF5 data set contains four array elements, hdf5read can<br />

return the data as a 1-by-4 array of hdf5.h5array objects:<br />

whos<br />

Name Size Bytes Class<br />

data 1x4 hdf5.h5array<br />

Grand total is 4 elements using 0 bytes<br />

For more information about the <strong>MATLAB</strong> HDF5 data type objects, see<br />

“Mapping HDF5 Data Types to <strong>MATLAB</strong> Data Types” on page 7-18.<br />

Exporting Data to HDF5 Files<br />

To write data or metadata from the <strong>MATLAB</strong> workspace to an HDF5 file, use<br />

the hdf5write function. As arguments, specify:<br />

• Name of an existing HDF5 file, or the name you want to assign to a new file.<br />

7-16

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

Saved successfully!

Ooh no, something went wrong!