% -------------------------------------------------------------------------
function cdfPut(Var,thename,prec,Att,Size,ncid)
dimid = [];
for h = 1:length(Size)
    dimid = [dimid; netcdf.defDim(ncid,[thename,'d',num2str(h)],Size(h))];
end
varid = netcdf.defVar(ncid,thename,prec,dimid);
netcdf.endDef(ncid);
netcdf.putVar(ncid,varid,Var);
netcdf.reDef(ncid);
if ~isempty(Att);
    Attv = struct2cell(Att);
    Attn = fieldnames(Att);
    for h = 1:length(Attn)
        netcdf.putAtt(ncid,varid,char(Attn(h)),char(Attv(h)));
    end
end
%netcdf.endDef(ncid);