First of all, about 95% of all the problems reported to me have to do with installing the mex-file on windows. If you have R2008b or higher, there's no longer any need to do that because MATLAB has native netcdf support now. Read on, you may find the answer to your problems below.
??? Error using ==> netcdflib Library failure "Can't open HDF5 attribute". Error in ==> open at 51 [varargout{:}] = netcdflib ( 'open', filename, mode );
What's most likely happening is that you are dealing with a netCDF-4 file that was created with the 4.1.1 library version of netCDF. The error will happen when two coordinate variables are defined in the opposite order in which their respective dimensions are defined. With 4.1.x, this results in a special hidden attribute called _Netcdf4Dimid being created for the purpose of imposing what netcdf considers to be the correct creation order for the dimension. But 4.0.x clients cannot read this attribute because of its dataspace specification, and the nc_open library function will fail because of it.
For further information about this issue, please reference the C.3.5 Dimension and Coordinate Variable Ordering section at Unidata.
This issue goes away if you have R2011b or a more recent versions of MATLAB.
Other than upgrading, the only real workaround I can recommend involves using MATLAB's HDF5 interface to strip out those _Netcdf4Dimid attributes. Try this script, but only after you have backed up your data, because this script modifies your file. The one visible side-effect that it may have is that your dimensions may get re-ordered. This should not affect netCDF variables, though.
??? Undefined variable "NetcdfFile" or class "NetcdfFile.open". Error in ==> snctools\private\nc_info_java at 23 jncid = NetcdfFile.open(ncfile); Error in ==> nc_info at 57 fileinfo = nc_info_java(ncfile); Error in ==> nc_dump at 55 info = nc_info ( file_name );
Most likely the netcdf-java jar file has not been added to your path. Look at the output of javaclasspath.
>> javaclasspathWay down at the bottom, in the DYNAMIC JAVA PATH section, you should see the netcdf-jar file. If it's not there, then that's your problem.
Testing GRIB... Testing NC_ATTGET...??? Error using ==> test_nc_attget>test_grib2_char at 480 failed
Check the version of netcdf-java that you have against the recommended version (can be found on the page from which you downloaded SNCTOOLS). Many people seem to be trying to run SNCTOOLS with toolsUI-4.0, which is too early for SNCTOOLS to use to read GRIB2 files.
Undefined function or method 'vanilla_mexnc'
It means that you must be using R2008a or below and tried to create or write to a netcdf file. In order to do that, you need to have a mex-file installed in mexcdf/mexnc/private and it either wasn't installed properly or wasn't installed at all. Go check the download page for instructions (and read them carefully this time!!!).
Check the location where you actually placed the netcdf.dll
.
You DO have the netcdf.dll
file, right??? If you don't, then
you need to go back to
Sourceforge and look for the
instructions about installing the mexnc mex-file. You'll have to retrieve a separate
zip file that has both the mex-files for each platform as well as the netcdf DLL for
windows.
The netcdf DLL file must lie somewhere on your system path.
Not your matlab path, but your system path. If you have write access
to your MATLAB installation, then a good place to put it is
C:\path\to\matlab\bin\win32
.
If it's not there, then it has to be somewhere on your system path. You may
find some useful information about
setting your system path here.
If you have R2008b or more recent, you should never have to worry about this. If you don't use windows, you never have to worry about this.
I did not write it and have not supported it since 2007. I continually get asked about it, so if you really need it badly, you can get a version here on the condition that you never ever ask me about it again.
It's part of the NetCDF Toolbox, which I do not support. See the item above.
For example...
>> nc = netcdf('ocean_his.nc') Undefined function 'netcdf' for input arguments of type 'char'.
You are trying to use the NetCDF Toolbox, which I do not support. See the previous two items.
You are trying to use the NetCDF Toolbox, which I do not support. See the previous three items.