These examples were created while helping users and are not fully tested.
Attributes
Create a root group attribute: C
Datasets
Read in floating point values from a text file and create an HDF5 file and dataset and add the values to the dataset: C float.txt
Example of reading large dataset by chunk size to help with performance: C
Create a file family: C
Datatypes
Create a variable length string attribute with Unicode name and value: C
Create simple fixed length string, read back and get size and storage size of string: C
Create a fixed length string dataset with a Unicode name and value: C
Work with array datatypes: C (See H5T_ARRAY Datatype for the difference between a dataset with an array size/shape (dataspace) and an array datatype.)
- Create an array datatype of variable length strings
- Create an array datatype of integer and long
- Create an array datatype of compound of a variable length string and integer
General
Check for an existing object in a file: (H5Lexists)
Turn off error messaging: (H5Eset_auto2)
Turn on error messaging in the HDF5 tools such as h5ls
or h5dump
: (specify --enable-error-stack
)
Store a binary object (such as a PDF or MS Word document) in an HDF5 file? Click here.
- Writing a user block in an HDF5 file: C
- Reading the user block file from the HDF5 file without the HDF5 library: C
Parallel
Open and read a dataset in different groups with different ranks: F90
Selecting a Subset
Append to 2D dataset by column: C
Append to 2D dataset by row: C
Append to a compound dataset in a loop: C
Append to compound enum dataset: C
Append to variable length string dataset: C
Read 2D dataset by column: C
Read 2D dataset by row: C
Select a subset from a 1D integer dataset: C
Select a subset from a 3D integer dataset: C
Select a subset from a 4D integer dataset: C
Compound
Append to a compound dataset in a loop: C
Create/write a compound enum dataset: C
Append to compound enum dataset: C
Overwrite a field (string) in a compound dataset: C
Overwrite a field (variable length string) in a compound dataset: C
Create/write to a compound variable length integer: C
Create/write to a compound dataset with a variable length string field: C
Create/write a compound array of variable length strings: C
Create/write to a compound array of variable length of fixed size strings: C
Read h5ex_t_cmpd.h5 file as a general application might: C
Read h5ex_t_cpxcmpd.h5 file as a general application might: C
Create a compound opaque dataset: C
Create a compound of a compound of array of integers (nested): C
Create a compound of a compound of fixed length strings (nested): C
Create a compound of a compound of an array of compound (nested): C
Create a variable length of compound variable length string: (h5cpx.c)
Create an array of compound with a 3D array field: (h5arrayb.c)
--- Last Modified: April 15, 2021 | 11:13 AM