Products & Services Solutions Academia Support User Community Company

Learn more about MATLAB   

netcdf.defDim - Create netCDF dimension

Syntax

dimid = netcdf.defDim(ncid,dimname,dimlen)

Description

dimid = netcdf.defDim(ncid,dimname,dimlen) creates a new dimension in the netCDF file specified by ncid, wheredimname is a character string that specifies the name of the dimension and dimlen is a numeric value that specifies its length. To define an unlimited dimension, specify the predefined constant 'NC_UNLIMITED' for dimlen, using netcdf.getConstant to retrieve the value.

netcdf.defDim returns dimid, a numeric ID corresponding to the new dimension.

This function corresponds to the nc_def_dim function in the netCDF library C API. To use this function, you should be familiar with the information about netCDF contained in the NetCDF C Interface Guide for version 3.6.2.

Examples

This example creates a new file and defines two dimensions in the file. One dimension is an unlimited dimension. To run this example, you must have write permission in your current directory.

% Create a netCDF file.
ncid = netcdf.create('foo.nc','NC_NOCLOBBER')

% Define a dimension.
latdimID = netcdf.defDim(ncid,'lat',50);

% Define an unlimited dimension.
londimID = netcdf.defDim(ncid,'lon',netcdf.getConstant('NC_UNLIMITED'));

See Also

netcdf.getConstant

  


Recommended Products

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.

 © 1984-2009- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS