我试图创建一个netcdf文件,但遇到了一个错误。我以前用过这个脚本,它很有效,所以我不明白为什么它说其中一个论点是错误的。代码为:
numcolO=numel(ObservationLong);
numrow=1;
numrow12=12;
numrow19=19;
%Read and display the variable from the file.
NameNetcdf='FinOctNovDec2012.nc';
ncid = netcdf.create(NameNetcdf,'CLOBBER');%NC_WRITE
dimidrow = netcdf.defDim(ncid,'rows',numrow);
dimidrowDates=netcdf.defDim(ncid,'timecol',numrow19);
dimidcol = netcdf.defDim(ncid,'length',numcolO);
dimidrowNames=netcdf.defDim(ncid,'namecol',numrow12);
varid = netcdf.defVar(ncid,'MagObs','NC_DOUBLE',[dimidcol dimidrow]);
varid2 = netcdf.defVar(ncid,'MagMod1','NC_DOUBLE',[dimidcol dimidrow]);
varid3 = netcdf.defVar(ncid,'MagMod2','NC_DOUBLE',[dimidcol dimidrow]);
varid4 = netcdf.defVar(ncid,'MagMod3','NC_DOUBLE',[dimidcol dimidrow]);
varid5 = netcdf.defVar(ncid,'MagMod4','NC_DOUBLE',[dimidcol dimidrow]);
varid6 = netcdf.defVar(ncid,'Dates','NC_CHAR',[dimidcol dimidrowDates]);
varid7 = netcdf.defVar(ncid,'Depthz','NC_DOUBLE',[dimidcol dimidrow]);
varid8 = netcdf.defVar(ncid,'EMag1','NC_DOUBLE',[dimidcol dimidrow]);
varid9 = netcdf.defVar(ncid,'EMag2','NC_DOUBLE',[dimidcol dimidrow]);
varid10 = netcdf.defVar(ncid,'EMag3','NC_DOUBLE',[dimidcol dimidrow]);
varid11 = netcdf.defVar(ncid,'EMag4','NC_DOUBLE',[dimidcol dimidrow]);
netcdf.endDef(ncid);
netcdf.putVar(ncid,varid,ObservationLong);
netcdf.putVar(ncid,varid2,ModelLong1);
netcdf.putVar(ncid,varid3,ModelLong2);
netcdf.putVar(ncid,varid4,ModelLong3);
netcdf.putVar(ncid,varid5,ModelLong4);
netcdf.putVar(ncid,varid6,char(date));
netcdf.putVar(ncid,varid7,DLong);
netcdf.putVar(ncid,varid8,EMag1);
netcdf.putVar(ncid,varid9,EMag2);
netcdf.putVar(ncid,varid10,EMag3);
netcdf.putVar(ncid,varid11,EMag4);
netcdf.close(ncid);
错误为:
>> NetcdfSimple
Error using netcdflib
The NetCDF library encountered an error during execution of 'create' function - 'Invalid
argument (22)'.
Error in netcdf.create (line 61)
ncid = netcdflib('create', filename, mode);
Error in NetcdfSimple (line 8)
ncid = netcdf.create(NameNetcdf,'CLOBBER');%NC_WRITE
但唯一的参数是NameNetcdf,即"FinOctNovDec2012.nc"one_answers"CLOBBER",根据netcdf.create帮助,这是一个有效的参数。
如何修复此错误?
问题是我想写入的文件夹在一个满了的U盘上。设备上没有足够的空间。这与争论无关。