Main Content

matlab.io.hdf4.sd.create

Namespace: matlab.io.hdf4.sd

Create new dataset

Syntax

sdsID = create(sdID,name,datatype,dims)

Description

sdsID = create(sdID,name,datatype,dims) creates a dataset with the given name name, data type datatype, and dimension sizes dims.

To create a dataset with an unlimited dimension, the last value in dims should be set to 0.

This function corresponds to the SDcreate function in the HDF library C API, but because MATLAB® uses FORTRAN-style ordering, the dims parameter is reversed with respect to the C library API.

Examples

Create a 3D dataset with an unlimited dimension.

import matlab.io.hdf4.*
sdID = sd.start('myfile.hdf','create');
sdsID = sd.create(sdID,'temperature','double',[10 20 0]);
sd.endAccess(sdsID);
sd.close(sdID);

See Also