You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: nc_write.m
    path of file: ./repos/tracacode/1911-COAWST/script/mfiles/rutgers/netcdf
    
    the code of the file until where you have to start completion: function status = nc_write(ncfile, Vname, f, varargin)

%
% NC_WRITE:  Writes a variable into a NetCDF file
%
% status = nc_write(ncfile, Vname, f, Tindex)
%
% This routine writes in a generic variable into a NetCDF file.
%
% On Input:
%
%    ncfile      NetCDF file name (string)
%
%    Vname       NetCDF variable name to read (string)
%
%    f           Field (scalar, matrix or array)
%
%    Tindex      Optional, time index to write (integer):
%
%                  *  If tindex is not provided as an argument during
%                     function call, it is assumed that the entire
%                     variable is to be written. 
%
%                  *  If variable has an unlimited record dimension,
%                     tindex can be used to increase that dimension or
%                     replace an already existing record.
%
%                  *  If variable has the word "time" in its dimension
%                     name, tindex can be used to write at the specified
%                     the time record.
%
% On Output:
%
%    status      Error flag
%

% svn $Id: nc_write.m 938 2019-01-28 06:35:10Z a
    
function status = nc_write_matlab(ncfile, Vname, f, Tindex, Info)

%
% NC_WRITE_MATLAB:  Writes a variable into a NetCDF file
%
% status = nc_write(ncfile, Vname, f, Tindex, Info)
%
% This routine writes the specified variable into a NetCDF file using the
% native interface.
%
% On Input:
%
%    ncfile      NetCDF file name (string)
%
%    Vname       NetCDF variable name to read (string)
%
%    f           Field (scalar or array)
%
%    Tindex      Optional, time index to write:
%
%                  *  If Tindex is not provided as an argument during
%                     function call, it is assumed that entire variable
%                     is to be written. 
%
%                  *  If variable has an unlimited record dimension,
%                     Tindex can be used to increase that dimension or
%                     replace an already existing record.
%
%                  *  If variable has the word "time" in its dimension
%                     name, Tindex can be use to write at the specified
%                     the time record.
%
%    Info        NetCDF information structure (struct array)
%
% On Output:
%
%    status      Error flag
%

% Initialize.

if (isempty(Tindex))
  time_rec = false;
else
  time_rec = true;
end