Skip to Main Content Skip to Search
Product Documentation

netcdf.defVarFill - Define fill parameters for NetCDF variable

Syntax

netcdf.defVarFill(ncid,varid,noFillMode,fillValue)

Description

netcdf.defVarFill(ncid,varid,noFillMode,fillValue) sets the fill parameters for the NetCDF variable identified by varid. ncid specifies the location.

For netCDF-4 files, you can only specify fill values when the NetCDF is in definition mode (before calling netcdf.endDef). For NetCDF files in classic and 64-bit offset modes, you can turn no-fill mode on and off at any time.

Input Arguments

ncid

Identifier of a NetCDF file, returned by netcdf.create or netcdf.open, or of a NetCDF group, returned by netcdf.defGrp.

varid

Identifier of a NetCDF variable, returned by netcdf.defVar.

noFillMode

Boolean value. When set to true, turns off use of fill values for the variable, which can be helpful in high performance applications. When true, netcdf.defVarFill ignores the value of the fillValue argument. To use the fill value, set this to false.

fillValue

Specifies the value to use in the variable when no other value is specified. The data type must be the same data type as the variable.

Examples

This example creates a NetCDF file and defines a fill value for a variable.

ncid = netcdf.create('myfile.nc','NETCDF4');
dimid = netcdf.defDim(ncid,'latitude',180);
varid = netcdf.defVar(ncid,'latitude','double',dimid);
netcdf.defVarFill(ncid,varid,false,-999);
netcdf.close(ncid);

References

This function corresponds to the nc_def_var_fill function in the NetCDF library C API.

For copyright information, read the netcdfcopyright.txt and mexnccopyright.txt files.

See Also

netcdf | netcdf.inqVarFill | netcdf.setFill

  


Free MATLAB Interactive Kit

Explore how to use MATLAB to make advancements in engineering and science.


Download free kit

Trials Available

Try the latest version of MATLAB and other MathWorks products.


Get trial software
 © 1984-2012- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS