netcdf.delAtt
netCDF 属性を削除します。
構文
netcdf.delAtt(ncid,varid,attName)
説明
netcdf.delAtt(ncid,varid,attName) は、attName によって識別される属性を削除します。attName は文字ベクトルまたは string スカラーとして指定します。
ncid は、関数 netcdf.create または関数 netcdf.open によって返される netCDF ファイル識別子です。
varid は、変数を識別する数値です。グローバル属性を削除するには、varid に対して netcdf.getConstant('GLOBAL') を使用します。属性を削除するには定義モードにしなければなりません。
この関数は、NetCDF ライブラリ C API の関数 nc_del_att に相当します。この関数を使用するには、NetCDF プログラミング パラダイムに関する知識が必要です。
例
この例では、MATLAB® に含まれている netCDF サンプル ファイル 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