Skip to Main Content Skip to Search
Product Documentation

netcdf.renameDim - Change name of netCDF dimension

Syntax

netcdf.renameDim(ncid,dimid,newName)

Description

netcdf.renameDim(ncid,dimid,newName) renames the dimension identified by the dimension identifier, dimid.

newName is a character string specifying the new name. ncid is a netCDF file identifier returned by netcdf.create or netcdf.open

This function corresponds to the nc_rename_dim function in the netCDF library C API. To use this function, you should be familiar with the netCDF programming paradigm. See netcdf for more information.

Examples

This examples modifies a local copy of the example netCDF file included with MATLAB, example.nc.

% Open netCDF file.
ncid = netcdf.open('my_example.nc','NC_WRITE')

% Put file is define mode.
netcdf.reDef(ncid)

% Get the identifer of a dimension to rename.
dimid = netcdf.inqDimID(ncid,'x');

% Rename the dimension.
netcdf.renameDim(ncid,dimid,'Xdim')

% Verify that the name changed.
data = netcdf.inqDim(ncid,dimid)

data =

Xdim

See Also

netcdf.defDim

  


Free MATLAB Interactive Kit

Explore how to use MATLAB to make advancements in engineering and science.


Download free kit

Trials Available

Try the latest version of MATLAB and other MathWorks products.


Get trial software
 © 1984-2012- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS