© 2007 the mathworks, inc. ® ® using hdf5 in matlab jeff mather the mathworks hdf/hdf-eos...

10
© 2007 The MathWorks, Inc. ® ® Using HDF5 in MATLAB Jeff Mather The MathWorks HDF/HDF-EOS Workshop XI (Nov. 2007)

Post on 15-Jan-2016

223 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: © 2007 The MathWorks, Inc. ® ® Using HDF5 in MATLAB Jeff Mather The MathWorks HDF/HDF-EOS Workshop XI (Nov. 2007)

© 2

007

The

Mat

hWor

ks, I

nc.

® ®

Using HDF5 in MATLAB

Jeff Mather

The MathWorks

HDF/HDF-EOS Workshop XI (Nov. 2007)

Page 2: © 2007 The MathWorks, Inc. ® ® Using HDF5 in MATLAB Jeff Mather The MathWorks HDF/HDF-EOS Workshop XI (Nov. 2007)

2

® ®

What is MATLAB?

A high-level programming language.

An interactive design, exploration, and simulation environment.

A platform for performing diverse tasks in many disciplines:

Math and Optimization Statistics and Data Analysis Control System Design and Analysis Signal Processing and Communications Image Processing Test & Measurement Financial Modeling and Analysis Application Deployment Database Connectivity and Reporting Distributed Computing

Page 3: © 2007 The MathWorks, Inc. ® ® Using HDF5 in MATLAB Jeff Mather The MathWorks HDF/HDF-EOS Workshop XI (Nov. 2007)

3

® ®

MATLAB’s support for HDF products

HDF4 (v4.2r1)

HDF-EOS2 (v2.12v1.00)

HDF5 (v1.6.5)

Page 4: © 2007 The MathWorks, Inc. ® ® Using HDF5 in MATLAB Jeff Mather The MathWorks HDF/HDF-EOS Workshop XI (Nov. 2007)

4

® ®

A typical HDF5 function

herr_t H5Dread(hid_t dataset_id,

hid_t mem_type_id,

hid_t mem_space_id,

hid_t file_space_id,

hid_t xfer_plist_id,

void * buf )

success = H5Dread(dataset, H5T_STD_I32BE, H5S_ALL,

H5S_ALL, H5P_DEFAULT, buffer);

Page 5: © 2007 The MathWorks, Inc. ® ® Using HDF5 in MATLAB Jeff Mather The MathWorks HDF/HDF-EOS Workshop XI (Nov. 2007)

5

® ®

A typical HDF5 function

herr_t H5Dread(hid_t dataset_id,

hid_t mem_type_id,

hid_t mem_space_id,

hid_t file_space_id,

hid_t xfer_plist_id,

void * buf )

success = H5Dread(dataset, H5T_STD_I32BE, H5S_ALL,

H5S_ALL, H5P_DEFAULT, buffer);

(2) Note the frequent use of defined values and “constants.”

(4) Note the appearance of output on the right-hand side.

(3) Note the success value on the left-hand side.

(1) Note the void*.

Page 6: © 2007 The MathWorks, Inc. ® ® Using HDF5 in MATLAB Jeff Mather The MathWorks HDF/HDF-EOS Workshop XI (Nov. 2007)

6

® ®

A typical MATLAB function

[N, X] = hist(DATA)

Multiple left-hand arguments. Outputs on the left, inputs on the right. Very weakly typed.

Page 7: © 2007 The MathWorks, Inc. ® ® Using HDF5 in MATLAB Jeff Mather The MathWorks HDF/HDF-EOS Workshop XI (Nov. 2007)

7

® ®

Calling an HDF5 function in MATLAB

Csuccess = H5Dread(dataset, H5T_STD_I32BE, H5S_ALL,

H5S_ALL, H5P_DEFAULT, buffer);

MATLABbuffer = H5D.read(dataset, ‘H5T_STD_I32BE’, ‘H5S_ALL’,

‘H5S_ALL’, ‘H5P_DEFAULT’)

Page 8: © 2007 The MathWorks, Inc. ® ® Using HDF5 in MATLAB Jeff Mather The MathWorks HDF/HDF-EOS Workshop XI (Nov. 2007)

8

® ®

Let’s look at examples in MATLAB…

Page 9: © 2007 The MathWorks, Inc. ® ® Using HDF5 in MATLAB Jeff Mather The MathWorks HDF/HDF-EOS Workshop XI (Nov. 2007)

9

® ®

The H5ML interface

H5ML.compare_values

H5ML.get_constant_names

H5ML.get_constant_value

H5ML.get_function_names

H5ML.get_mem_datatype

H5ML.hoffset

H5ML.sizeof

+ H5ML.id

Page 10: © 2007 The MathWorks, Inc. ® ® Using HDF5 in MATLAB Jeff Mather The MathWorks HDF/HDF-EOS Workshop XI (Nov. 2007)

10

® ®

Getting help

To see what’s in a package: “help H5D”

For help on an HDF5 function: “help H5D.read”

To use the full power of HDF5, you need to understand the C or Fortran interface.

E-mail [email protected].