Main Content


Display contents of HDF5 file



h5disp(filename) displays the metadata that describes the structure of the specified HDF5 file.


h5disp(filename,loc) displays the metadata for the specified location within the file.


h5disp(filename,loc,mode), where mode is 'min', displays only the group and dataset names. The default for mode is 'simple', which displays the dataset metadata and attribute values.

h5disp(___,'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

Create a 50-by-50 dataset with a chunk size of 5-by-5.

h5create('exampleFile2.h5','/exampleDataset',[50,50],'ChunkSize',[5 5])

Display the metadata of the HDF5 file. In this example, the HDF5 file contains one dataset within its root group. The attributes belonging to the dataset are displayed below its name.

HDF5 exampleFile2.h5 
Group '/' 
    Dataset 'exampleDataset' 
        Size:  50x50
        MaxSize:  50x50
        Datatype:   H5T_IEEE_F64LE (double)
        ChunkSize:  5x5
        Filters:  none
        FillValue:  0.000000

Display the attributes of a dataset /g4/world in the file example.h5. If you specify the full path of a dataset in an HDF5 file, h5disp will only display the attributes of the dataset.

HDF5 example.h5 
Dataset 'world' 
    Size:  36x19
    MaxSize:  36x19
    Datatype:   H5T_IEEE_F64LE (double)
    ChunkSize:  []
    Filters:  none
    FillValue:  0.000000

Display only group and dataset names by specifying the display mode 'min'.

HDF5 example.h5 
Dataset 'world' 

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 full path to a location in the file. To display the metadata for the entire file, specify '/' as the location. If loc is a group, h5disp displays all objects in the group.

Display mode, specified as one of these values:

  • 'simple' — Display dataset names and attribute values if the attribute is an integer, floating point, or a scalar string.

  • 'min' — Display only group and dataset names.

Version History

Introduced in R2011a

expand all