Quantcast

Documentation Center

  • Trial Software
  • Product Updates

H5A.open_by_idx

Open attribute specified by index

Syntax

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)

Description

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'.

Examples

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

fid = H5F.open('example.h5');
gid = H5G.open(fid,'/g1/g1.1');
dset_id = H5D.open(fid,'/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));
		H5A.close(attr_id);
end
H5G.close(gid);
H5F.close(fid);

See Also

| |

Was this topic helpful?