This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.


Define fill parameters for NetCDF variable




netcdf.defVarFill(ncid,varid,noFillMode,fillValue) sets the fill parameters for a variable in a NetCDF-4 file. varid identifies the variable and the ncid identifies the NetCDF-4 file.

For netCDF 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


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


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


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.


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.


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

ncid = netcdf.create('','NETCDF4');
dimid = netcdf.defDim(ncid,'latitude',180);
varid = netcdf.defVar(ncid,'latitude','double',dimid);


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.

Was this topic helpful?