.. highlightlang:: us .. index:: nc_varput_text .. _nc_varput_text: nc_varput_text ============== .. us.tag nc_varput_text ENGLISH NC_Var New6002 The :ref:`nc_varput_text` functions writes string data values into a netCDF variable of an open netCDF file. The file must be in data mode. .. function:: r = nc_varput_text(ncid, varid, rsStart, rsCount, svData) .. 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. The data type must be NC_CHAR. The variable must have two dimensions. .. uparam:: rvStart *rsStart* is the start index. The index starts with 0. .. uparam:: rsCount *rsCount* is the number of elemenst to write. *rsCount* must correspond to the variable's first dimension. .. uparam:: svData *svData* is a string vector. .. us.example **Example** **Beispiel** :: svData = ["Text1", "Another Text", "A Long Text"]; ncid = nc_create("d:/test.nc"); dimid1 = nc_dimdef(ncid, "n", len(svData)); dimid2 = nc_dimdef(ncid, "nChar", max(strlen(svData))); // longest text varid = nc_vardef(ncid, "text", NC_CHAR, [dimid1, dimid2]); nc_endef(ncid); nc_varput_text(ncid, varid, 0, len(svData), svData); 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_varput`, :ref:`nc_varput_missing`, :ref:`strcode` :sub:`id-885951`