end % append additional attributes for jj = 1:size(OPT.additionalAtts,2) Variable.Attribute(end+1).Name = OPT.additionalAtts{1,jj}; Variable.Attribute(end+0).Value = OPT.additionalAtts{2,jj}; end % add variable to output file switch OPT.nc_library case 'snc' nc_addvar(OPT.outputfile, Variable); varargout = {[]}; case 'matlab' varid = netcdf_addvar(OPT.ncid, Variable ); if OPT.deflate netcdf.defVarDeflate(OPT.ncid,varid,false,true,2); end varargout = {varid}; end end