problem editing specific variables in a netcdf file using ncwrite
4 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Brice Coffer
el 18 de En. de 2019
Respondida: Zenin Easa Panthakkalakath
el 21 de En. de 2019
I'm trying to edit values in a netcdf file using ncread and ncwrite. For example,
foo = ncread('myfile.nc','x')
Where foo is:
10×1 single column vector
1
2
3
9999
5
6
7
8
9
10
So I want to change the fourth element from 9999 to 4 and write the array back to my netcdf file.
foo(4) = 4
ncwrite('myfile.nc','x',foo)
However, I get the following error:
Error using netcdflib
The NetCDF library encountered an error during execution of 'open' function - 'HDF error (NC_EHDFERR)'.
Error in netcdf.open (line 59)
[varargout{:}] = netcdflib ( 'open', filename, varargin{1} );
Error in internal.matlab.imagesci.nc/openToAppend (line 1238)
this.ncRootid = netcdf.open(this.Filename,'WRITE');
Error in internal.matlab.imagesci.nc (line 123)
this.openToAppend();
Error in ncwrite (line 71)
ncObj = internal.matlab.imagesci.nc(ncFile,'a',formatStr);
0 comentarios
Respuesta aceptada
Zenin Easa Panthakkalakath
el 21 de En. de 2019
Hi Brice,
It appears to be that the NC file specified in the 'filename' variable is not editable. Use the file explorer to have a look into the properties of the file and check if it is 'Read Only'. Also, look into the security tab under properties and see if the current user has the privilege to Modify the file.
Regards,
Zenin
0 comentarios
Más respuestas (0)
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!