我有2个数组,我想读入2个netcdf变量。我编写的代码没有给出错误,但是读取了错误的值。
[a,b]=size(PuntX);%a=1 b=86
[c,d]=size(PuntY);%c=1 d=86
ncid = netcdf.create('122009a.nc','NC_NOCLOBBER');
dimid = netcdf.defDim(ncid,'x',b);
varid = netcdf.defVar(ncid,'i','NC_DOUBLE',dimid);
varid2 = netcdf.defVar(ncid,'j','NC_DOUBLE',dimid);
netcdf.endDef(ncid);
netcdf.putVar(ncid,varid,PuntX)
netcdf.putVar(ncid,varid2,PuntY)
我得到的输出是:
Source:
G:\LECOB\Data\SAVED\122009a.nc
Format:
classic
Dimensions:
x = 86
Variables:
i
Size: 86x1
Dimensions: x
Datatype: double
j
Size: 86x1
Dimensions: x
Datatype: double
这就是我想要的,但是它不是读取PuntX和PuntY的值(介于500和600之间),而是读取相同的86次,即:
i =
1.0e+36 *
9.9692
9.9692
...
9.9692
如何获取正确的数字?