Hi, I want to write a string to netcdf. I can write NC_DOUBLE without problems. So far I have:
ncid = netcdf.create(ncfullfilename ,'NC_WRITE');heightsteps = netcdf.defDim(ncid,'rows',finaldimen(1));timesteps = netcdf.defDim(ncid,'length',finaldimen(2));varidH = netcdf.defVar(ncid,'Height','NC_DOUBLE',[heightsteps 1]);varidP355 = netcdf.defVar(ncid,'P355','NC_DOUBLE',[heightsteps timesteps]);% all this works fine, now:
varidTime = netcdf.defVar(ncid,'Time','NC_CHAR',[timesteps 20]);
>>> Error using netcdflib
The NetCDF library encountered an error during execution of 'defVar' function – 'Invalid dimension ID or
name (NC_EBADDIM)'.
Error in netcdf.defVar (line 38)
varid = netcdflib('defVar', ncid, varname, xtype, dimids);
However, I can read in just 1 character by:
varidTime = netcdf.defVar(ncid,'Time','NC_CHAR',1)
"Time" may look like this: 20-Jun-2017-06:14:50
Can you tell me what I do wrong?
Thanks and best regards
Christoph Ritter
Best Answer