netcdf.inqAttName
netCDF 属性の名前を返します。
構文
attname = netcdf.inqAttName(ncid,varid,attnum)
説明
attname = netcdf.inqAttName(ncid,varid,attnum)
は属性の名前を含む文字ベクトル attname
を返します。
ncid
は、関数 netcdf.create
または関数 netcdf.open
によって返される netCDF ファイル識別子です。
varid
は、ファイル内の変数の数値識別子です。ファイルのグローバル属性の名前を取得するには、varid
の代わりに netcdf.getConstant('NC_GLOBAL')
を使用します。attnum
は、0 では 1 番目の属性、1 では 2 番目の属性を示す、属性を指定する 0 ベースの数値です。
この関数は、NetCDF ライブラリ C API の関数 nc_inq_attname
に相当します。この関数を使用するには、NetCDF プログラミング パラダイムに関する知識が必要です。
例
この例では、MATLAB® に含まれている netCDF サンプル ファイル example.nc
を開きます。
% Open netCDF example file. ncid = netcdf.open('example.nc','NC_NOWRITE'); % Get identifier of a variable in the file. varid = netcdf.inqVarID(ncid,'avagadros_number') % Get the name of the attribute associated with the variable. attname = netcdf.inqAttName(ncid,varid,0) attname = description % Get the name of the global attribute associated with the variable. gattname = netcdf.inqAttName(ncid,netcdf.getConstant('NC_GLOBAL'),0) gattname = creation_date