Main Content

Identifier (H5I)

HDF5 object identifiers

Description

Use the MATLAB® HDF5 identifier interface, H5I, to handle HDF5 identifiers and access information about them.

HDF5 identifiers uniquely identify common HDF5 resources, such as files, groups, datasets, dataspaces, attributes and properties. They are returned by the functions that create or open these resources and are passed to functions that operate on or with these resources. You must close an object identifier after it is processed.

Functions

H5I.dec_ref

Decrement reference count

refcount = H5I.dec_ref(objID) decrements the reference count of the object specified by objID and returns the new count.

H5I.get_file_id

File identifier for specified object

fileID = H5I.get_file_id(objID) returns the identifier of the file associated with the object specified by objID.

H5I.get_name

Name of object

name = H5I.get_name(objID) returns the name of the group, dataset, or datatype specified by objID. If no name is attached to the object, H5I.get_name returns an empty character vector.

name = H5I.get_name(objID,"TextEncoding",encoding) additionally specifies the text encoding to use to interpret the object name.

 Details

H5I.get_ref

Reference count of object

refcount = H5I.get_ref(objID) returns the reference count of the object specified by objID.

H5I.get_type

Type of object

objtype = H5I.get_type(objID) returns the type of the object identified by objID.

 Details

H5I.inc_ref

Increment reference count of specified object

refcount = H5I.inc_ref(objID) increments the reference count of the object specified by objID and returns the new count.

H5I.is_valid

Determine if specified identifier is valid

output = H5I.is_valid(objID) returns a positive value if the identifier objID is valid, and 0 if it is not.

Examples

expand all

fid = H5F.open("example.h5");
gid = H5G.open(fid,"/g4");
fid2 = H5I.get_file_id(gid);
name = H5F.get_name(fid2);
fprintf("The filename is %s.\n",name);
H5G.close(gid);
H5F.close(fid);
H5F.close(fid2);

Version History

Introduced before R2006a

expand all