HDF error (NC_EHDFERR) in netcdf.close using ncwrite
Show older comments
I used the same script many times with a different computer and an older version of matlab without problems. Now with Matlab R2020b I get this warning and subsequent error. It occurs when a variable is written into an empty netCDF file.
Warning: The following error was caught while executing 'onCleanup' class destructor:
Error using netcdflib
The NetCDF library encountered an error during execution of 'close' function - 'HDF error (NC_EHDFERR)'.
Error in netcdf.close (line 16)
netcdflib('close', ncid);
Error in internal.matlab.imagesci.nc/close (line 139)
netcdf.close(this.ncRootid);
Error in ncwrite>@()ncObj.close() (line 84)
cleanUp = onCleanup(@()ncObj.close());
Error in onCleanup/delete (line 80)
obj.task();
Error in ncwrite (line 61)
if nargin > 0
Together with the warning, I get a popup:
"workspace browser will not function if 'built in' or 'workspacefunc' is shadowed"
The next step results in the error:
Error using netcdflib
The NetCDF library encountered an error during execution of 'inqVar' function - 'HDF error (NC_EHDFERR)'.
Error in netcdf.inqVar (line 26)
[varname,xtype,dimids,natts] = netcdflib('inqVar', ncid, varid);
Error in internal.matlab.imagesci.nc/varInfo (line 1370)
netcdf.inqVar(gid,varid);
Error in internal.matlab.imagesci.nc/write (line 752)
varinfo = this.varInfo(gid, varid);
Error in ncwrite (line 87)
ncObj.write(varName, varData, start, stride);
Is there anything new in netcdflib of the HDF library that might collide with my code? Sorry, I can`t provide the whole script, it is too nested. I am thankful for every small hint!
1 Comment
Walter Roberson
on 24 Sep 2022
Edited: Walter Roberson
on 10 Jan 2023
Answers (1)
Jalin
on 24 Sep 2022
Have you solved the problem? I also encountered this problem
Thank you very much for any reply
The NetCDF library encountered an error during the 'getVarFloat' function - 'HDF error (NC_EHDFERR)'.
Categories
Find more on NetCDF Files in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!