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.


Delete netCDF attribute




netcdf.delAtt(ncid,varid,attName) deletes the attribute identified by the character vector attName.

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

varid is a numeric value that identifies the variable. To delete a global attribute, use netcdf.getConstant('GLOBAL') for the varid. You must be in define mode to delete an attribute.

This function corresponds to the nc_del_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 opens a local copy of the example netCDF file included with MATLAB®,

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

% Determine number of global attributes in file.
[numdims numvars numatts unlimdimID] = netcdf.inq(ncid);

numatts =


% Get name of attribute; it is needed for deletion.
attname = netcdf.inqAttName(ncid,netcdf.getConstant('NC_GLOBAL'),0)

% Put file in define mode to delete an attribute.

% Delete the global attribute in the netCDF file.

% Verify that the global attribute was deleted.
[numdims numvars numatts unlimdimID] = netcdf.inq(ncid);

numatts =
Was this topic helpful?