problem editing specific variables in a netcdf file using ncwrite
4 ビュー (過去 30 日間)
古いコメントを表示
Brice Coffer
2019 年 1 月 18 日
回答済み: Zenin Easa Panthakkalakath
2019 年 1 月 21 日
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 件のコメント
採用された回答
Zenin Easa Panthakkalakath
2019 年 1 月 21 日
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 件のコメント
その他の回答 (0 件)
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!