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 much need to do that because MATLAB has native netcdf support now. But if you are still stuck with R2008a or below and can't get a working installation going, read on...
??? Error using ==> snctools\private\nc_info_java Could not open netCDF URL.
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: If you have the download for R2008b, you don't need it. Otherwise check the download instructions again for R2008a. Did you get the 2nd required download for R2008a and below?
A: As of R2006a, the new mex-file is called "mexnc.mexw32".
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!
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 jar file to your path using javaaddpath? Check the README.
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.