Documentation

This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

H5R.get_obj_type

Type of referenced object

Syntax

obj_type = H5R.get_obj_type(id,ref_type,ref)

Description

obj_type = H5R.get_obj_type(id,ref_type,ref) returns the type of object that an object reference points to. Valid values for ref_type are: H5R_OBJECT or H5R_DATASET_REGION. Valid return values correspond to the following values.

'H5O_TYPE_GROUP'Object is a group.
'H5O_TYPE_DATASET'Object is a dataset.
'H5O_TYPE_NAMED_DATATYPE'Object is a named datatype.

This function corresponds to the 1.8 interface version of H5Rget_obj_type in the HDF5 library C API.

Examples

plist = 'H5P_DEFAULT';
space = 'H5S_ALL';
fid = H5F.open('example.h5');
dset_id = H5D.open(fid,'/g3/reference');
ref_data = H5D.read(dset_id,'H5T_STD_REF_OBJ',space,space,plist);
obj_type = H5R.get_obj_type(fid,'H5R_OBJECT',ref_data(:,1));
switch(obj_type)
    case H5ML.get_constant_value('H5O_TYPE_GROUP')
        fprintf('group\n');
    case H5ML.get_constant_value('H5O_TYPE_DATASET')
        fprintf('dataset\n');
    case H5ML.get_constant_value('H5O_TYPE_NAMED_DATATYPE')
        fprintf('named datatype\n');
end
H5D.close(dset_id);
H5F.close(fid);
Was this topic helpful?