Main Content


Information about HDF5 file



info = h5info(filename) returns information about an entire HDF5 file, including information about the groups, datasets, and named datatypes contained within it.


info = h5info(filename,loc) returns information about the specified location in the HDF5 file.

info = h5info(filename,loc,'TextEncoding','UTF-8') forces object and attribute names to be treated as UTF-8-encoded text. This usage is unnecessary if the HDF5 file accurately specifies the use of UTF-8 encoding.


collapse all

Return information about the entire file 'example.h5'.

info = h5info('example.h5')
info = struct with fields:
      Filename: '/mathworks/devel/bat/filer/batfs1904-0/Bdoc24a.2528353/build/matlab/toolbox/matlab/demos/example.h5'
          Name: '/'
        Groups: [4x1 struct]
      Datasets: []
     Datatypes: []
         Links: []
    Attributes: [2x1 struct]

Return information about the group g4.

info = h5info('example.h5','/g4')
info = struct with fields:
      Filename: '/mathworks/devel/bat/filer/batfs1904-0/Bdoc24a.2528353/build/matlab/toolbox/matlab/demos/example.h5'
          Name: '/g4'
        Groups: []
      Datasets: [4x1 struct]
     Datatypes: []
         Links: []
    Attributes: []

Return information about the dataset time in the group g4.

info = h5info('example.h5','/g4/time')
info = struct with fields:
      Filename: '/mathworks/devel/bat/filer/batfs1904-0/Bdoc24a.2528353/build/matlab/toolbox/matlab/demos/example.h5'
          Name: 'time'
      Datatype: [1x1 struct]
     Dataspace: [1x1 struct]
     ChunkSize: 10
     FillValue: 0
       Filters: []
    Attributes: [2x1 struct]

Input Arguments

collapse all

Filename of an existing HDF5 file, specified as a string scalar or character vector.

Depending on the location of your file, filename can take one of these forms.



Current folder

Specify the name of the file in filename.

Example: "myFile.h5"

Other folders

If the file is not in the current folder or in a folder on the MATLAB® path, then specify the full or relative path in filename.

Example: "C:\myFolder\myFile.h5"

Example: "myFolder\myFile.h5"

Remote location

If the file is stored at a remote location, then filename must contain the full path of the file specified as a uniform resource locator (URL) of the form:


Based on your remote location, scheme_name can be one of the values in this table.

Remote Locationscheme_name
Amazon S3™s3
Windows Azure® Blob Storagewasb, wasbs

For more information, see Work with Remote Data.

Example: "s3://myBucket/myFolder/myFile.h5"

  • If your file consists of several physical files using the Family driver, specify filename using a format specifier. For example, to use the Family driver with the two files family0.h5 and family1.h5, specify filename as "family%d.h5".

  • If your file consists of several physical files using the Multi driver or the Split driver, specify filename as the leading prefix of the names of the physical files. For example, to use the Multi driver with the six files multi-b.h5, multi-g.h5, multi-l.h5, multi-o.h5, multi-r.h5, and multi-s.h5, specify filename as "multi".

Location in the file, specified as a character vector or string scalar containing the file path of a group, dataset, or named datatype in the file. To return information about the entire file, specify '/' as the location.

Output Arguments

collapse all

File information returned as a structure. The structure has different fields depending on the loc argument points to a file or group, dataset, or named datatype. The following tables list the fields that are present for each location type.

Files and Groups

NameCharacter vector specifying name of the group or dataset. If you specify only the HDF5 file name, the function will return information about the root group.
GroupsArray of structures describing subgroups.
DatasetsArray of structures describing datasets.
DatatypesArray of structures describing named datatypes.
LinksArray of structures describing soft, external, user-defined, and certain hard links.
Attributes Array of structures describing group attributes.


NameCharacter vector specifying the name of the dataset.
DatatypeStructure describing the datatype.
DataspaceStructure describing the size of the dataset.
ChunkSizeDimensions of the dataset chunk size, if defined.
FillValueFill value for missing data, if defined.
FilterArray of structures describing any defined filters, such as compression.
AttributesArray of structures describing dataset attributes.

Named Datatypes

NameCharacter vector specifying the name of the datatype object.
Class HDF5 class of the named datatype.
TypeCharacter vector or structure further describing the datatype.
SizeSize of the named datatype in bytes.

Version History

Introduced in R2011a

expand all