Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

The following comments pertain to the ex_table_01.c programming example.

The dst_size parameter contains the size in bytes of the structure associated with the table. This value is obtained with sizeof:

...

The following example demonstrates how to create and write a table with the function H5TB_MAKE_TABLE. The corresponding HDF5 file that is generated is also referenced here. You can use an HDF5 file browser to access this file by clicking on the link below.

C Example

HDF5 file

Anchor
02
02

 

 

To append records to a table the H5TB_APPEND_RECORDS function is used. This function adds records to the end of the table. The dataset is extended to hold the new records.

...

The following C program provides an example of how to append records to a table. The corresponding HDF5 file that is generated is also referenced here. You can use an HDF5 file browser to access this file by clicking on the link below.

C Example

HDF5 file

Anchor
03
03

 

 

To overwrite records in a table use the H5TB_WRITE_RECORDS function. This function overwrites one or several records by specifying a start record and the number of records to write.

...

The following C program provides an example of how to overwrite records in a table. The table is initially filled with a set of fill values. The corresponding HDF5 file that is generated is also referenced here. You can use an HDF5 file browser to access this file by clicking on the link below.

C Example

HDF5 file

Anchor
04
04

 

 

Individual fields can be written, either by specifying the names or indices. To overwrite fields in a table by name use the H5TB_WRITE_FIELDS_NAME function. This function overwrites one or several fields by specifying their names and a start record and the number of records to write. In the following example, the field Pressure is overwritten, writing three records starting at record 2:

...

The following C program provides an example of how to overwrite fields in a table, by specifying the field names.

C Example

HDF5 file

 

Anchor
05
05

 

 

Individual fields can also be written by specifying their indices. To overwrite fields in a table by index the H5TB_WRITE_FIELDS_INDEX function is used. This function overwrites one or several fields by specifying their indices, a start record and the number of records to write.

...

The following C program provides an example of how to overwrite fields in a table, by specifying the field indices.

C Example

HDF5 file

 

Anchor
06
06

 

 

Information about a table can be retrieved using two functions, H5TB_GET_TABLE_INFO and H5TB_GET_FIELD_INFO. The H5TB_GET_TABLE_INFO retrieves the table dimensions (the number of records and the number of fields).

...

The following C program provides an example of how to retrieve information from a table. The corresponding HDF5 file that is generated is also referenced here. You can use an HDF5 file browser to access this file by clicking on the link below.

C Example

HDF5 file

 

Anchor
07
07

 

 

Several contiguous records can be deleted from a table using the H5TB_DELETE_RECORD function. This function is simple to use. A start position and the number of records to delete are all that needs to be specified. For example:

...

The following C program provides an example of how to use this function. The corresponding HDF5 file that is generated is also referenced here. You can use an HDF5 file browser to access this file by clicking on the link below.

C Example

HDF5 file

Anchor
08
08

 

 

It is possible to insert records in any position of a table. To insert records in a table the H5TB_INSERT_RECORD function is used. This function is similar to the H5TB_DELETE_RECORD function, but has an extra parameter for the data being written.

...

The following C program provides an example of how to insert records in a table. The corresponding HDF5 file that is generated is also referenced here. You can use an HDF5 file browser to access this file by clicking on the link below.

C Example

HDF5 file

Anchor
09
09

 

 

The H5TB_ADD_RECORDS_FROM function is used to add records from one table to another.

...

The following C program provides an example of adding records from one table to another. The corresponding HDF5 file that is generated is also referenced here. You can use an HDF5 file browser to access this file by clicking on the link below.

C Example

HDF5 file

Anchor
10
10

 

 

Two tables can be combined into a third, using the function H5TB_COMBINE_TABLES. To use this function only the names of the tables are necessary. In the following example, two tables, "table1" and "table2" are combined into a new table called "table3":

...

The following C program provides an example of combining tables. The corresponding HDF5 file that is generated is also referenced here. You can use an HDF5 file browser to access this file by clicking on the link below.

C Example

HDF5 file

Anchor
11
11

 

A new field can be inserted into a table, using the function H5TB_INSERT_FIELD. To use this function, the field name, its type, the position where to insert the field and the data to insert in the table must be supplied.

...

The following C program provides an example of inserting a new field into a table. The corresponding HDF5 file that is generated is also referenced here. You can use an HDF5 file browser to access this file by clicking on the link below.[

C Example

HDF5 file

 

Anchor
12
12

 

The function H5TB_DELETE_FIELD is used to delete a field from a table. To use this function only the field name is supplied.

...

The following C program provides an example of deleting a field from a table. The corresponding HDF5 file that is generated is also referenced here. You can use an HDF5 file browser to access this file by clicking on the link below.

C Example

HDF5 file