Удаление атрибута 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 в API библиотеки C netCDF. Для использования этой функции необходимо ознакомиться с парадигмой программирования 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