hdf images hdf images

HDF5 Tutorial:   Advanced Topics
Compound Datatypes


Creating Compound Datatypes

A compound datatype is similar to a struct in C or a common block in FORTRAN. It is a collection of one or more datatypes and can include compound datatypes. To create and use a compound datatype you need to be familiar with various properties of the compound datatype: Properties of members of a compound datatype are defined when the member is added to the compound datatype and cannot be subsequently modified.

Compound datatypes must be built out of other datatypes. First, one creates an empty compound datatype and specifies its total size. Then members are added to the compound datatype in any order.

High Level APIs

The High Level HDF5 Table APIs (H5TB) include functions to easily create tables in HDF5, using a compound datatype. Please be sure to review them, in addition to this tutorial.

Programming Example


This example shows how to create a dataset with a compound datatype, write data to it, and then read data back.


- - Last modified: 21 December 2016