This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.


Create HDF5 data set




h5create(filename,datasetname,size,Name,Value) creates an HDF5 data set in the file specified by filename.

Input Arguments


Character vector or string scalar specifying the name of an HDF5 file. If filename does not already exist, h5create creates it, with additional options specified by one or more Name,Value pair arguments.


Character vector or string scalar specifying the name of the data set you want to create. If datasetname is a full path name, h5create creates all intermediate groups, if they don't already exist.


Array specifying the extents of the dataset. To specify an unlimited extent, set the corresponding element of size to Inf.

Name-Value Pair Arguments

Specify optional comma-separated pairs of Name,Value arguments. Name is the argument name and Value is the corresponding value. Name must appear inside quotes. You can specify several name and value pair arguments in any order as Name1,Value1,...,NameN,ValueN.


Any of the following MATLAB® datatypes.


Default: 'double'


Defines chunking layout.

Default: Not chunked


Defines gzip compression level (0-9).

Default: 0


Defines the fill value for numeric data sets.


Turns on the Fletcher32 checksum filter.

Default: false


Turns on the Shuffle filter.

Default: false


Character encoding, specified as 'system' or 'UTF-8'.

  • 'system' — Use the system default encoding to create the dataset name.

  • 'UTF-8' — Use UTF-8 encoding to create the dataset name.

Default: 'system'


collapse all

Create a fixed-size 100-by-200 data set.

h5create('myfile.h5','/myDataset1',[100 200])
HDF5 myfile.h5 
Group '/' 
    Dataset 'myDataset1' 
        Size:  100x200
        MaxSize:  100x200
        Datatype:   H5T_IEEE_F64LE (double)
        ChunkSize:  []
        Filters:  none
        FillValue:  0.000000

Create a single-precision 1000-by-2000 data set with a chunk size of 50-by-80. Apply the highest level of compression.

h5create('myfile.h5','/myDataset2',[1000 2000],'Datatype','single', ...
          'ChunkSize',[50 80],'Deflate',9)
HDF5 myfile.h5 
Group '/' 
    Dataset 'myDataset2' 
        Size:  1000x2000
        MaxSize:  1000x2000
        Datatype:   H5T_IEEE_F32LE (single)
        ChunkSize:  50x80
        Filters:  deflate(9)
        FillValue:  0.000000

Create a two-dimensional data set that is unlimited along the second extent.

h5create('myfile.h5','/myDataset3',[200 Inf],'ChunkSize',[20 20])
HDF5 myfile.h5 
Group '/' 
    Dataset 'myDataset3' 
        Size:  200x0
        MaxSize:  200xInf
        Datatype:   H5T_IEEE_F64LE (double)
        ChunkSize:  20x20
        Filters:  none
        FillValue:  0.000000

Introduced in R2011a