problem editing specific variables in a netcdf file using ncwrite
6 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Brice Coffer
le 18 Jan 2019
Réponse apportée : Zenin Easa Panthakkalakath
le 21 Jan 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 commentaires
Réponse acceptée
Zenin Easa Panthakkalakath
le 21 Jan 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 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur NetCDF dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!