Main Content

Group (H5G)

Organization of objects in file

Description

Use the MATLAB® HDF5 group interface, H5G, to create, open, close, and access information about groups in an HDF5 file.

Groups are structures that contain other objects in the HDF5 file. Typically, groups contain other groups and datasets.

Functions

H5G.close

Close group

H5G.close(groupID) releases resources used by the group identifier specified by groupID. The identifier groupID was returned by either H5G.create or H5G.open.

H5G.create

Create group

groupID = H5G.create(locID,groupname,size) creates a new group with the name specified by groupname at the location specified by locID. This syntax corresponds to the H5Gcreate interface in version 1.6 of the HDF5 C library.

groupID = H5G.create(locID,groupname,lcplID,gcplID,gaplID) creates a new group with additional property list, specified by lcplID, gcplID, and gaplID. This syntax corresponds to the H5Gcreate interface in version 1.8 of the HDF5 C library.

 Details

H5G.flush

Flush all data buffers to disk (since R2021b)

H5G.flush(groupID) causes all buffers associated with a group groupID to be immediately flushed to disk without removing the data from the cache.

H5G.get_info

Information about group

info = H5G.get_info(groupID) returns information about the group specified by groupID.

H5G.open

Open specified group

groupID = H5G.open(locID,groupname) opens the group specified by groupname at the location specified by the file or group identifier locID. This function corresponds to the H5Gopen interface in version 1.6 of the HDF5 C library.

groupID = H5G.open(locID,groupname,gaplID) opens the group with an additional group access property list specified by gaplID. This function corresponds to the H5Gopen interface in version 1.8 of the HDF5 C library.

H5G.refresh

Clear and reload all data buffers (since R2021b)

H5G.refresh(groupID) causes all buffers associated with a group specified by groupID to be cleared and immediately reloaded with updated contents from disk.

Examples

expand all

Create an HDF5 file 'myfile.h5' with a group 'my_group' with default property list settings.

fid = H5F.create('myfile.h5');
plist = 'H5P_DEFAULT';
gid = H5G.create(fid,'my_group',plist,plist,plist);
H5G.close(gid);
H5F.close(fid);
fid = H5F.open('example.h5');
gid = H5G.open(fid,'/g2');
info = H5G.get_info(gid);
H5G.close(gid);
H5F.close(fid);
Introduced before R2006a