MATLAB: How to set environment variables for Compiler applications from bash / ksh / sh in MATLAB 7.5 (R2007b)

ashMATLAB Compilerpdkshzsh

I can run my MATLAB Compiler-generated application from the csh (C) shell using the LD_LIBRARY_PATH and related variables, but SETENV is not available in the bash, ksh, or sh shells on Linux/UNIX/Mac.

Best Answer

The documentation for MATLAB 7.6 (R2008a) has been updated to incorporate the relevant information. For previous product releases, read below for any possible workarounds:
1. For the bash (Bourne Again) and ksh (Korn) shells:
Instead of the csh command SETENV, you can use the bash / ksh equivalent EXPORT command. A command specified as:
csh> setenv VARIABLE value1:value2:...
should be entered as:
bash> export VARIABLE=value1:value2:...
For example, the LD_LIBRARY_PATH definition supplied as:
csh> setenv LD_LIBRARY_PATH <matlabroot>/sys/os/glnxa64:<matlabroot>/bin/glnxa64:...
should be entered as:
bash> export LD_LIBRARY_PATH=<matlabroot>/sys/os/glnxa64:<matlabroot>/bin/glnxa64:...
2. For the sh (Bourne) shell, these commands are similar, but definition and export must be done as separate steps:
VARIABLE=value1:value2:...
export VARIABLE
3. In both cases, the directory lists themselves are unchanged from the csh versions in the documentation.