Main Content

matlab.io.hdf4.sd.setDimName

Namespace: matlab.io.hdf4.sd

Associate name with dimension

Syntax

setDimName(dimID,dimname)

Description

setDimName(dimID,dimname) sets the name of the dimension identified by dimID to dimname.

This function corresponds to the SDsetdimname function in the HDF library C API.

Examples

Create a 2D dataset with dimensions 'lat' and 'lon'.

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

See Also