Main Content

matlab.io.hdfeos.gd.setFillValue

Namespace: matlab.io.hdfeos.gd

Set fill value for specified field

Syntax

setFillValue(gridID,fieldname,fillvalue)

Description

setFillValue(gridID,fieldname,fillvalue) sets the fill value for the specified field. The fill value should have the same data type as the field.

This function corresponds to the GDsetfillvalue function in the HDF-EOS library C API.

Examples

Create a new double-precision field with a fill value of -1.

import matlab.io.hdfeos.*
srcFile = fullfile(matlabroot,"toolbox","matlab","matlab_sci","hdf4","grid.hdf");
copyfile(srcFile,"myfile.hdf")
fileattrib("myfile.hdf","+w")
gfid = gd.open("myfile.hdf","rdwr");
gridID = gd.attach(gfid,"PolarGrid");
gd.defComp(gridID,"none")
gd.defField(gridID,"newfield",["XDim" "YDim"],"double")
gd.setFillValue(gridID,"newfield",-1)
gd.detach(gridID)
gd.close(gfid)