Documentation of getatt


Global Index (short | long) | Local contents | Local Index (short | long)


Function Synopsis

varargout = getatt(varargin);

Help text


  varargout = getatt(filin, varargin);

  filin = NETCDF file to read
  varargin = string of variables, and attributes to read
    e.g.:  

  [u_units, z3_offset] = getatt(filin, 'U', 'units', 'Z3', 'add_offset');


Cross-Reference Information

This function is called by

Listing of function getatt

function varargout = getatt(varargin);
nout = nargout;
nin = nargin;

filin = varargin{1};

if (nout ~= ((nin - 1) / 2));
  error(['The number of input arguments must equal twice the number of '...
         'output arguments, plus 1']);
end

nc = netcdf(filin, 'nowrite');

for i = 1:nout;

  varnam = varargin{(2 * i)};
  attnam = varargin{(2 * i) + 1};

  evalstr = ['tem = nc{varnam}.' attnam '(:);'];
  eval(evalstr);

  varargout{i} = tem(1:(length(tem)-2));

end

nc = close(nc);