Q:

Runnig multiple instances of MATLAB and LD_LIBRARY_PATH value

I am trying to run multiple instances of MATLAB, so far, so good. Each instance will be running an M-file. Where each M-file will be playing with LD_LIBRARY_PATH variable, as following: 
    MatlabPath = getenv('LD_LIBRARY_PATH');
    setenv('LD_LIBRARY_PATH',getenv('PATH'))
    !java -cp . MyApp
    setenv('LD_LIBRARY_PATH',MatlabPath) 

I have tried to figure out if this can cause some problem at any point but could not find an information on that. 
Will there be any serious consequences of running two such M-files simultaneously, but within two different instances? 

A:

The answer is NO. It won't make any difference for another instance of Matlab. 
The following experiment proves it:
In the first instance of Matlab: 
See the old values and chane the value of this variable by following commands: 
To check: 
getenv('LD_LIBRARY_PATH')
getenv('PATH')

To change:
MatlabPath = getenv('LD_LIBRARY_PATH')
setenv('LD_LIBRARY_PATH',getenv('PATH'))

Go to the second instance of Matlab: 
And chech what is the value of LD_LIBRARY_PATH variable, by following command: 
getenv('LD_LIBRARY_PATH')

It must be its actual value and not the updated one.  

