Documentation

This is machine translation

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

cdflib.renameVar

Rename existing variable

Syntax

cdflib.renameVar(cdfId,varNum,newName)

Description

cdflib.renameVar(cdfId,varNum,newName) renames a variable in a Common Data Format (CDF) file.

cdfId identifies the CDF file. varNum is a numeric value that identifies the variable. Variable numbers are zero-based. newName is a text string that specifies the name you want to assign to the variable.

Examples

Create a CDF, create a variable in the CDF, and then rename the variable. To run this example, you must be in a writable folder.

cdfid = cdflib.create('your_file.cdf');

% Create a variable in the file.
varNum = cdflib.createVar(cdfid,'Time','cdf_int1',1,[],true,[]);

% Get the name of the variable. 
name = cdflib.getVarName(cdfid,varNum)

name = 

Time

% Rename the variable
cdflib.renameVar(cdfid,varNum,'NewName');

% Check the new name.
name = cdflib.getVarName(cdfid,varNum)

name =

NewName

%  Clean up
cdflib.delete(cdfid)

clear cdfid

Related Examples

References

This function corresponds to the CDF library C API routine CDFrenamezVar.

To use this function, you must be familiar with the CDF C interface. Read the CDF documentation at the CDF website.

For copyright information, see the cdfcopyright.txt file.

Was this topic helpful?