Products & Services Solutions Academia Support User Community Company

Learn more about MATLAB   

netcdf.renameAtt - Change name of attribute

Syntax

netcdf.renameAtt(ncid,varid,oldName,newName)

Description

netcdf.renameAtt(ncid,varid,oldName,newName) changes the name of the attribute specified by the character string oldName.

newName is a character string that specifies the new name.

ncid is a netCDF file identifier returned by netcdf.create or netcdf.open.

varid identifies the variable to which the attribute is associated. To specify a global attribute, use netcdf.getConstant('NC_GLOBAL') for varid.

This function corresponds to the nc_rename_att 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 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')

% Get the ID of a variable the attribute is associated with.
varID = netcdf.inqVarID(ncid,'avagadros_number')

% Rename the attribute.
netcdf.renameAtt(ncid,varID,'description','Description');

% Verify that the name changed.
attname = netcdf.inqAttName(ncid,varID,0)

attname =

Description

See Also

netcdf.inqAttName

  


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