Home > atmlab > arts > netcdf > arts_nc_write_matrix.m

arts_nc_write_matrix

PURPOSE ^

ARTS_NC_WRITE_MATRIX Write Matrix to ARTS NetCDF file.

SYNOPSIS ^

function arts_nc_write_matrix (filename, v, varargin)

DESCRIPTION ^

 ARTS_NC_WRITE_MATRIX   Write Matrix to ARTS NetCDF file.

    Writes a Matrix to a NetCDF file for use with Arts.

 FORMAT   arts_nc_write_matrix(filename, v, varargin)
        
 IN    filename  Name of NetCDF file.
 IN    v         Matrix variable.
 OPT   varargin  Cell array of name/value pair cells for global attributes

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

DOWNLOAD ^

arts_nc_write_matrix.m

SOURCE CODE ^

0001 % ARTS_NC_WRITE_MATRIX   Write Matrix to ARTS NetCDF file.
0002 %
0003 %    Writes a Matrix to a NetCDF file for use with Arts.
0004 %
0005 % FORMAT   arts_nc_write_matrix(filename, v, varargin)
0006 %
0007 % IN    filename  Name of NetCDF file.
0008 % IN    v         Matrix variable.
0009 % OPT   varargin  Cell array of name/value pair cells for global attributes
0010 
0011 % 2010-02-03   Created by Oliver Lemke.
0012 
0013 function arts_nc_write_matrix (filename, v, varargin)
0014 
0015 ncid = netcdf.create (filename, 'NC_CLOBBER');
0016 
0017 attributes = optargs( varargin, { [] } );
0018 
0019 if (~isempty(attributes))
0020     addncattributes (ncid, attributes);
0021 end
0022 
0023 s = size(v);
0024 rdim = netcdf.defDim (ncid, 'nrows', s(1));
0025 cdim = netcdf.defDim (ncid, 'ncols', s(2));
0026 
0027 varid = netcdf.defVar (ncid, 'Matrix', 'double', [cdim rdim]);
0028 
0029 netcdf.endDef (ncid);
0030 
0031 netcdf.putVar (ncid, varid, v');
0032 
0033 netcdf.close (ncid);

Generated on Mon 15-Sep-2014 13:31:28 by m2html © 2005