Удаление атрибута netCDF
netcdf.delAtt(ncid,varid,attName)
netcdf.delAtt(ncid,varid,attName) удаляет атрибут, идентифицированный как attName. Задайте attName как вектор символов или строковый скаляр.
ncid - идентификатор файла netCDF, возвращаемый netcdf.create или netcdf.open.
varid является числовым значением, которое идентифицирует переменную. Чтобы удалить глобальный атрибут, используйте netcdf.getConstant('GLOBAL') для varid. Вы должны быть в режиме определения, чтобы удалить атрибут.
Эта функция соответствует nc_del_att функция в библиотеке netCDF С API. Чтобы использовать эту функцию, вы должны ознакомиться с парадигмой программирования netCDF.
Этот пример открывает локальную копию примера файла netCDF, включенного в MATLAB®, example.nc.
% Open a netCDF file.
ncid = netcdf.open('my_example.nc','NC_WRITE')
% Determine number of global attributes in file.
[numdims numvars numatts unlimdimID] = netcdf.inq(ncid);
numatts =
1
% 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.
netcdf.reDef(ncid);
% Delete the global attribute in the netCDF file.
netcdf.delAtt(ncid,netcdf.getConstant('GLOBAL'),attname);
% Verify that the global attribute was deleted.
[numdims numvars numatts unlimdimID] = netcdf.inq(ncid);
numatts =
0