Main Content

netcdf.inqDimID

次元 ID を返します。

構文

dimid = netcdf.inqDimID(ncid,dimname)

説明

dimid = netcdf.inqDimID(ncid,dimname) は、dimname に対応する dimid を返します。dimname は文字ベクトルまたは string スカラーとして指定します。関数 netcdf.inqDim を使用して次元名を取り出せます。ncid は、関数 netcdf.create または関数 netcdf.open によって返される netCDF ファイル識別子です。

この関数は、NetCDF ライブラリ C API の関数 nc_inq_dimid に相当します。この関数を使用するには、NetCDF プログラミング パラダイムに関する知識が必要です。

この例では、MATLAB® に含まれている netCDF サンプル ファイル example.nc を開きます。

% Open netCDF example file.
ncid = netcdf.open('example.nc','NC_NOWRITE');

% Get name and length of first dimension
[dimname, dimlen] = netcdf.inqDim(ncid,0);

% Retrieve identifier of dimension.
dimid = netcdf.inqDimID(ncid,dimname)

dimid =

     0