.. highlightlang:: us .. _nc_varput_missing: nc_varput_missing ================= .. index:: nc_varput_missing .. us.tag nc_varput_missing ENGLISH NC_Var New330 The :ref:`nc_varput_missing` functions writes data values into a netCDF variable of an open netCDF file. The file must be in data mode. Missing values must have the value ``MISSING_VALUE``. .. function:: r = nc_varput_missing(ncid, varid, rvStart, rvCount, values) r = nc_varput_missing(ncid, varid, rvStart, rvCount, values, bCharAsByte) .. us.return **Return Value** *r* is -1 in case an error occurred. .. us.params **Parameters** .. uparam:: ncid Identifies the netCDF file. .. uparam:: varid *varid* is the ID of a variable. .. uparam:: rvStart *rvStart* is a vector of values specifying the multidimensional index of the corner of the hyperslab where the first of the data values will be read from. The size of *start* must be the same as the number of dimensions of the specified variable. The elements of *start* must correspond to the variable's dimensions in order. The indices are relative to 0. .. uparam:: rvCount *rvCount* is a vector of values specifying the multidimensional edge lengths from the corner of the hyperslab where the first of the data values will be read. To read a single value, for example, specify *rvCount* as [1,1,...,1]. The size of *rcCount* is the number of dimensions of the specified variable. The elements of *rvCount* correspond to the variable's dimensions. .. uparam:: values *values* is a vector or matrix of real values or a string. .. uparam:: bCharAsByte If *bCharAsByte* is TRUE (1) characters are specified as byte values (data type = NC_CHAR). For other data type this parameter has no meaning. Default value is FALSE (0). .. us.comment **Comment** Except for the handling of missing values the function is identical to :ref:`nc_varput`. It converts missing values ``MISSING_VALUES`` to the specified value depending on the data type: ``NC_FLOAT`` is replaced by ``MISSING_FLOAT`` and ``NC_DOUBLE`` is replaced to ``MISSING_DOUBLE``. .. us.example **Example** :: ncid = nc_create("d:/test.nc"); dimid = nc_dimdef(ncid, "n", 8); varid = nc_vardef(ncid, "channel", NC_FLOAT, dimid); nc_attput(ncid, varid, "missing_value", NC_FLOAT, -99); nc_endef(ncid); // translate MISSING_VALUE (10e10) to -99 nc_varput_missing(ncid, varid, 3, 4, [3,MISSING_VALUE,5,6]); nc_close(ncid); .. seealso:: :ref:`overview-netcdf-files`, :ref:`nc_create`, :ref:`nc_dimdef`, :ref:`nc_vardef`, :ref:`nc_endef`, :ref:`nc_redef`, :ref:`nc_close`, :ref:`nc_varget`, :ref:`nc_varget_missing`, :ref:`nc_varput`, :ref:`strcode` :sub:`id-1253990`