Main Content

Identifier (H5I)

HDF5 object identifiers

Description

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

HDF5 identifiers 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

Return 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

Return 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

Return reference count of object

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

H5I.get_type

Return 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

tf = H5I.is_valid(objID) determines whether the identifier objID is valid.

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);
Introduced before R2006a