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.

H5I.get_type

Type of object

Syntax

obj_type = H5I.get_type(obj_id)

Description

obj_type = H5I.get_type(obj_id) returns the type of the object specified by obj_id. obj_type corresponds to one of the following enumerated values.

H5I_FILE
H5I_GROUP
H5I_DATATYPE
H5I_DATASPACE
H5I_DATASET
H5I_ATTR
H5I_BADID

Examples

fid = H5F.open('example.h5');
gid = H5G.open(fid,'/g3');
dset_id = H5D.open(fid,'/g4/world');
[~,objs] = H5F.get_obj_ids(fid,'H5F_OBJ_ALL',3);
for j = 1:numel(objs)
    name = H5I.get_name(objs(j));
    fprintf('object ''%s'':  ==> ',name);
    type = H5I.get_type(objs(j));
    switch(type)
        case H5ML.get_constant_value('H5I_FILE')
            fprintf('FILE identifier.\n');
        case H5ML.get_constant_value('H5I_GROUP')
            fprintf('GROUP identifier.\n');
        case H5ML.get_constant_value('H5I_DATASET')
            fprintf('DATASET identifier.\n');
        otherwise
            fprintf('unknown identifier type.\n');
    end
end
H5G.close(gid);
H5F.close(fid);
Was this topic helpful?