How to read a hdf5 file without knowing the database name in Matlab

2.6k views Asked by At

I have a hdf5 database but almost no experience with that kind of database. I need to open / load it in Matlab. However the Matlab function h5read requires two arguments

data = h5read(filename,dataset)

I know my Filename (obviously :) ) but I don't know the dataset name (because I cannot look into the hdf5 databse).

Does anyone know how to find out the dataset names in a hdf5 database?

1

There are 1 answers

1
Alex On BEST ANSWER

From Mathworks, you can use h5info(or the deprecated hdf5info) to get the name of the datasets inside a hdf5 database

fileinfo = hdf5info(filename);

toplevel = fileinfo.GroupHierarchy

Gives:

  toplevel = 

  Filename: [1x64 char]
      Name: '/'
    Groups: [1x2 struct]
  Datasets: []
 Datatypes: []
     Links: []
Attributes: [1x2 struct]