This is machine translation

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

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.


Open attribute specified by index


attr_id = H5A.open_by_idx(loc_id,obj_name,idx_type,order,n)
attr_id = H5A.open_by_idx(loc_id,obj_name,idx_type,order,n,aapl_id,lapl_id)


attr_id = H5A.open_by_idx(loc_id,obj_name,idx_type,order,n) opens an existing attribute at index n attached to an object specified by its location, loc_id, and name, obj_name.

idx_type is the type of index and valid values include the following.

'H5_INDEX_NAME'An alpha-numeric index by attribute name
'H5_INDEX_CRT_ORDER'An index by creation order

order specifies the index traversal order. Valid values include the following.

'H5_ITER_INC' Iteration from beginning to end
'H5_ITER_DEC'Iteration from end to beginning
'H5_ITER_NATIVE'Iteration in the fastest available order

attr_id = H5A.open_by_idx(loc_id,obj_name,idx_type,order,n,aapl_id,lapl_id) opens an attribute with attribute access property list, aapl_id, and link access property list, lapl_id. The aapl_id argument must currently be specified as 'H5P_DEFAULT'. Also, lapl_id can be specified by 'H5P_DEFAULT'.


Loop through a set of dataset attributes in reverse alphabetical order.

fid ='example.h5');
gid =,'/g1/g1.1');
dset_id =,'/g1/g1.1/dset1.1.1');
info = H5O.get_info(dset_id);
for idx = 0:info.num_attrs-1
		attr_id =H5A.open_by_idx(gid,'dset1.1.1','H5_INDEX_NAME','H5_ITER_DEC',idx);
		fprintf('attribute name:  %s\n',H5A.get_name(attr_id));
Was this topic helpful?