Main Content

matlab.io.hdf4.sd.getDimStrs

Namespace: matlab.io.hdf4.sd

Predefined attributes for dimension

Syntax

[label,unit,format] = getDimStrs(dimID)

Description

[label,unit,format] = getDimStrs(dimID) returns the label, unit, and format attributes for the dimension identified by dimID.

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

Examples

import matlab.io.hdf4.*
sdID = sd.start('myfile.hdf','create');
sdsID = sd.create(sdID,'temperature','double',20);
dimID = sd.getDimID(sdsID,0);
sd.setDimName(dimID,'x');
sd.setDimStrs(dimID,'xdim','none','%d');
sd.endAccess(sdsID);
sd.close(sdID);
sdID = sd.start('myfile.hdf');
idx = sd.nameToIndex(sdID,'temperature');
sdsID = sd.select(sdID,idx);
dimID = sd.getDimID(sdsID,0);
[label,unit,fmt] = sd.getDimStrs(dimID);
sd.endAccess(sdsID);
sd.close(sdID);