??? Error using ==> snctools\private\nc_info_java Could not open netCDF URL.
Also, you should see what the following commands tell you before contacting me (because this will most likely be the first bit of information I ask of you). The paths may be slightly different on your system...
>> which( 'mexnc', '-all' ) C:\path\to\mexnc\mexnc.dll % on windows, will be mexnc.w32 on R2006a and higherOther platforms should see their appropriate mex-file extensions.
>> which( 'mexcdf53', '-all' ) C:\path\to\mexnc\mexcdf53.mMexcdf53 used to be the mex-file itself, but no longer. Now it is only an m-file that funnels its arguments into the real mex-file, mexnc. If your matlab path reflects a mex-file, then you should remove it from the matlab path.
A:
This might show up on linux if the partion under which you installed mexnc is mounted with the noexec option. Check your /etc/fstab file to see if this is the case. If it is, you need to either remove the noexec option and remount the partition, or just move mexnc to another partition.
A: Check that the folder containing "mexnc.mexw32" has appropriate permissions. Specifically,
A:
Check the location where you actually placed the netcdf.dll. It must lie somewhere
on your system path. Not your matlab path, but your system path.
Something like either
C:\path\to\matlab\bin
or
C:\path\to\matlab\bin\win32
A: It's there. Check the win32 directory. DO NOT, I repeat, DO NOT use a DLL from a prior installation, and do not download the DLL from Unidata.
A: It ain't there. As of R2006a, the new mex-file is called "mexnc.mexw32".
A: It ain't there either, because no one has built it and contributed it back. If you had any guts, you'd do it for me.
A: There is a test suite contained in the "test" subdirectory underneath mexnc. But don't bother with this unless you are either source-compiling your own mex-file or are convinced that something is horribly wrong with your installation!
Now, go back and read that last sentence one more time.
If you absolutely must run the tests, make sure you follow the directions in the README in that subdirectory.
The following command, though, is a real simple way of testing if the mex-file is completely wrong for you.
>> mexnc ( 'STRERROR', 0 )If the result is not
ans = No errorthen yes, you are right, something is horribly, horribly wrong.
??? Invalid MEX-file '/path/to/mexnc/mexnc.mexglx': /lib/i686/libc.so.6: version `GLIBC_2.3' not found (required by /path/to/mexnc/mexnc.mexglx).
A: Check your version of glibc (especially if you are using a debian system). It would seem that mex-files compiled on versions of glibc greater than 2.3 won't work with systems with glibc 2.2 or less. This is a case where you end up having to compile your own mex-file. You should search out the section of the mexopts.sh file for CFLAGS that reads
CFLAGS='-fPIC -ansi -D_GNU_SOURCE -pthread -fexceptions -m32'and get rid of the
-m32 flag, which changes it to
CFLAGS='-fPIC -ansi -D_GNU_SOURCE -pthread -fexceptions'MEXNC should now compile cleanly and run.
A: About the only good reason to run the test suite is if you are compiling your own version and want to contribute it back to me so I can post it for the benefit of others (in which case, thank you). Otherwise you really don't need to do that unless you suspect that there's a problem with your installation. Really.
Ok, fine, don't listen to me. If you must plow foreward with this, make sure you read the instructions carefully and agree with the questions that the test suite asks you. And then, if it still doesn't work, email me.
??? Error using ==> snctools\private\nc_info_java Could not open netCDF URL.
A: Did you add the toolsUI jar file to your path using javaaddpath? Check the README.
A: Yes, it will work just fine, but the normal build process will not work. Because HDF5 1.6.5 is a required component of MATLAB, and because netCDF-4 requires HDF5-1.8.0, one cannot get away with shared libraries. Everything has to be statically compiled, which results in a pretty big makefile (and a pretty big mex-file, the x86_64 version currently weighs in at 9.7 MB). Here's a makefile which will work on x86_64
HDF=/path/to/hdf5
NETCDF=/path/to/netcdf4
MATLAB=/path/to/your/matlab
CC=gcc
INCLUDES=-I${MATLAB}/extern/include
INCLUDES+=-I${HDF}/include
INCLUDES+=-I${NETCDF}/include
INCLUDES+=-I${HDF}/include
CFLAGS=-c -DMATLAB_MEX_FILE -g -fPIC -fno-omit-frame-pointer -ansi
CFLAGS+= -D_GNU_SOURCE -pthread -fexceptions -DMX_COMPAT_32
LDFLAGS=-g -pthread -shared
LDFLAGS+= -Wl,--version-script,${MATLAB}/extern/lib/glnxa64/mexFunction.map
LDFLAGS+= -Wl,--no-undefined
LPATH= -L${NETCDF}/lib -L${HDF}/lib -L${MATLAB}/bin/glnxa64
LIBS=-lmx -lmex -lmat -lm -lstdc++ -lnetcdf -lhdf5 -lhdf5_hl -lhdf5 -lz
OBJECTS=mexgateway.o netcdf2.o netcdf3.o common.o mexversion.o
mexversion.o: ${MATLAB}/extern/src/mexversion.c
${CC} ${CFLAGS} ${INCLUDES} $<
%.o: %.c
${CC} ${CFLAGS} ${INCLUDES} $<
mexnc: ${OBJECTS}
${CC} ${LDFLAGS} ${OBJECTS} -o mexnc.mexa64 ${LPATH} ${LIBS}
clean:
rm -f *.o
So what about it? It's completely unsupported. Use it at your own risk.
??? Invalid MEX-file '/home/jevans/matlab/mexcdf/mexnc/mexnc.mexglx': /opt/matlabR14sp2/bin/glnx86/../../sys/os/glnx86/libgcc_s.so.1: version `GCC_4.2.0' not found (required by /usr/lib/libstdc++.so.6).
A: You really shouldn't be seeing this anymore... but ...
The problem is basically a mismatch between the version of gcc und the C++ libraries used to compile matlab, and the versions found the current system. According to Mathworks, we haveNow suppose you have Mandriva 2007. Here are your options.
#############################################################################
#
# Architecture independent lines:
#
# Set and uncomment any lines which will apply to all architectures.
#
#----------------------------------------------------------------------------
CC="gcc-3.3.6"
#############################################################################
#
# Architecture independent lines:
#
# Set and uncomment any lines which will apply to all architectures.
#
#----------------------------------------------------------------------------
CC="gcc2.96"
The other trick to try is alluded to in the file ${MATLAB}/sys/os/glnx86/README.libstdc++, but you need to be the root user. Type these commands ...
# cd $MATLAB # cd sys/os/glnx86 # mkdir old # mv libstdc++.* libg2c.* libgcc_s* old
${MATLAB}/sys/os/glnxa64 instead of
${MATLAB}/sys/os/glnx86.