This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.


Change name of attribute




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

newName is a character vector specifying the new name.

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

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 netCDF programming paradigm. See netcdf for more information.


This example modifies a local copy of the example netCDF file included with MATLAB®,

% Open netCDF file.
ncid ='','NC_WRITE')

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

% Rename the attribute.

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

attname =

Was this topic helpful?