%% Write Elements of Variable
% Write to the first ten elements of the example temperature variable.

srcFile = fullfile(matlabroot,'toolbox','matlab','demos','example.nc');
copyfile(srcFile,'myfile.nc');
fileattrib('myfile.nc','+w');
ncid = netcdf.open('myfile.nc','WRITE');
varid = netcdf.inqVarID(ncid,'temperature');
data = [100:109];
netcdf.putVar(ncid,varid,0,10,data);
netcdf.close(ncid);

% Copyright 2012 The MathWorks, Inc.