Question

I am attempting to create a four dimensional NetCDF structure of integers using matlab. This is my code so far...

mode = netcdf.getConstant('NETCDF4');
mode = bitor(mode,netcdf.getConstant('CLASSIC_MODEL'));
ncid = netcdf.create('USTEC_01_01_2010.nc',mode);
latDimId = netcdf.defDim(ncid,'latitude',51);
longDimId = netcdf.defDim(ncid,'longitude',101);
satDimId = netcdf.defDim(ncid,'satellite',33);
timeDimId = netcdf.defDim(ncid,'time',96);
varid = netcdf.defVar(ncid,'TECgrid','int',[latDimId longDimId satDimId timeDimId]);

My question is...How do I go about using putVar to insert values at specific four dimensional positions? FYI, this is my first time using NetCDF. Thanks in advance! -Dom

Was it helpful?

Solution

Which version do you have? If you have a later version, look at these functions: nccreate and ncwrite.

Or:

netcdf.endDef(ncid);
% Write one specific value to the last position. 
% See help netcdf.putVar. start is zero based.
% start argument's order corresponds to dimension definition above.
netcdf.putVar(ncid,varid,[50 100 32 95], 10);

netcdf.close(ncid);
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top