Main Content

matlab.io.hdf4.sd.setDimScale

Namespace: matlab.io.hdf4.sd

Set scale values for dimension

Syntax

setDimScale(dimID,scaledata)

Description

setDimScale(dimID,scaledata) sets the scale values for a dimension.

This function corresponds to the SDsetdimscale 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');
sd.setDimScale(dimID,0:10:90);
dimID = sd.getDimID(sdsID,1);
sd.setDimName(dimID,'lon');
sd.setDimScale(dimID, -180:18:179);
sd.endAccess(sdsID);
sd.close(sdID);