It is a bit involved to run matlab with the nds2 client from conda
In order to run matlab using a nds2 client from a conda install you must set the LD_LIBRARY_PATH. As an example to run matlab2020a on the large test stand at LLO on x2work2 with nds2-client from the cds environment (default env) you would use:
LD_LIBRARY_PATH='nds-client-config --libdir' /ligo/apps/sl7/matlab_r2020a/bin/matlab
Then inside of matlab you would need to set the javaclasspath correctly. The following command will print the proper path:
system('nds-client-config --javaclasspath')
So you would then do a:
javaaddpath('/opt/conda/base/envs/cds-py39-2023030301/lib/nds2-client/java/nds2.jar')
At this point you can do nds2 commands.
>> c=nds2.connection('nds.ligo-la.caltech.edu') c = nds2.connection@5d5d9e5 >> c.countChannels() ans = 6437033
To get matlab working with nds2 from a conda environment, I had to launch it as follows:
LD_LIBRARY_PATH=/opt/conda/base/envs/cds/lib /ligo/apps/sl7/matlab_r2020a/bin/matlab
This is equivalent to:
LD_LIBRARY_PATH=nds-client-config --libdir
/ligo/apps/sl7/matlab_r2020a/bin/matlab
The issue is that conda seems to re-write the rpath? for .so files when it installs them so it is hardwired for the conda env, and the jnilib file that gets put in the jar file does not have this, so it cannot tell Matlab where to find libndsclient
(There is a copy of the jnilib that is shipped outside of the jar file, in ..../lib/java/nds2/libnds2JNI.jnilib which does get paths rewritten, but it isn't used by the jar file).
Not sure what to do about this.