Create HDF5 data set




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

Input Arguments


Text string 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.


Text string 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 single 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


collapse all

Create Fixed-Size Data Set

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 Data Set with Compression

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 Data Set with Unlimited Dimension

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

Related Examples

See Also

| | |

Introduced in R2011a

Was this topic helpful?