Documentation

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.

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

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
Was this topic helpful?