Hey Tanzima,

1. I have an hdf5 file. Is it possible to iterate through the different datasets and attributes etc.? If yes, how do I do that?

You can use H5Literate and H5Lvisit to iterate within a group in a flat and recursive way respectively. Check out the Link reference page:
http://www.hdfgroup.org/HDF5/doc/RM/RM_H5L.html#Link-Iterate
Within the callback you specify you can check for the type of the link in the info struct which will help you to decide what to do. I also found that the example code is a fantastic source of information about how things can be used. Below is a link to the sample C code for HDF5 version 1.8:
http://www.hdfgroup.org/ftp/HDF5/examples/examples-by-api/api18-c.html

2. How do I extract the names of the datasets from this file to begin with? I know how to extract info of a dataset once its name is given.

If you're not iterating/visiting through the file then you'll have to know explicitly what to query. The iterator functions supply a name to the callback, so you can use that. Alternatively, if you have an object id (dataset/group/...) you can use the H5Iget_name(...) function to return the name.
http://www.hdfgroup.org/HDF5/doc/RM/RM_H5I.html#Identify-GetName

I hope this has helped.

Richard.

_______________________________________________
Hdf-forum is for HDF software users discussion.
[email protected]
http://mail.hdfgroup.org/mailman/listinfo/hdf-forum_hdfgroup.org

Reply via email to