For Windows TOMLAB requires the directory tomlab/shared to be included in the environment variable PATH.
For all other operating systems TOMLAB requires the tomlab/shared folder to be present in the LD_LIBRARY_PATH environment variable before invoking MATLAB (DYLD_LIBRARY_PATH on Mac OS X). It is possible to set this in several ways.
The library search path environment variable name differs between different systems. On Linux it is called LD_LIBRARY_PATH, while on Mac OS X it is DYLD_LIBRARY_PATH. On Windows, it is the PATH variable.
The way environment variables are set varies depending on operating systems and shells.
To set the PATH environment variable permanently on Windows, do: Control Panel → System → Advanced → Environment Variables. Assuming TOMLAB was installed in C:\tomlab, append (or prepend) C:\tomlab\shared separated to the other entries with a semi-colon (;) to the PATH environment variable.
One can also set the PATH environment variable temporarily in a running command shell. This is done by doing
C:\> set PATH=%PATH%;C:\tomlab\shared
This change will only be applied in that command shell, and will therefore be discarded when the command shell is terminated.
Set on command line when invoking MATLAB:
[user@host:~]$ LD_LIBRARY_PATH=[$LD_LIBRARY_PATH:]/tpath/shared <ml> &
where <ml> is the name of your MATLAB executable and tpath is the TOMLAB installation path. If LD_LIBRARY_PATH is already set to something and you wish to preserve this, include the part in [ ].
Set in $HOME/.bashrc, $HOME/.profile, $HOME/.cshrc (or $HOME/.matlab7rc.sh if it exists):
export LD_LIBRARY_PATH=/tpath/shared[:$LD_LIBRARY_PATH] # bash setenv LD_LIBRARY_PATH /tpath/shared[:$LD_LIBRARY_PATH] # csh and similar
If installing for multiple users, you can add similar settings to /etc/profile, or optionally to $MATLAB/bin /.matlab7rc.sh.
Mac OS X users should set DYLD_LIBRARY_PATH instead of LD_LIBRARY_PATH.
A potential problem concerning shared library versions may lead to crashes when running certain TOMLAB MEX files. This is related to MATLAB and/or the runtime linker loading the wrong version of a support library.
The following workaround is suggested:
Start Matlab 7.8 from a shell prompt with the following option:
[user@host:~] LD_PRELOAD=$TOMLAB/shared/libgfortran.so.1.0.0 \ LD_LIBRARY_PATH=$TOMLAB/shared \ $MATLAB78 &
In the above command, replace $TOMLAB with the path to your TOMLAB installation, and $MATLAB78 with the name of your MATLAB 7.8 binary. This may vary depending on your particular setup, e.g. if having a symbolic link to the MATLAB binary or not. You may need to specify the full path to the MATLAB installation. For example:
[user@host:~]$ LD_PRELOAD=/home/user/tomlab/shared/libgfortran.so.1.0.0 \ LD_LIBRARY_PATH=/home/user/tomlab/shared \ /usr/local/matlab78/bin/matlab &