title: (Mac,Matlab,bash) Changing the PATH of bash in Matlab for system commands
body: <p>Hello Fellow Matlab Users,</p>
  
  <p>I was wondering if anyone could provide me with some insight on how to change the bash path environment in Matlab. </p>
  
  <p>Basically, if I start a given application in the terminal outside of Matlab everything works fine. (e.g.: <code>3dMean</code>)
  However, if I try it in Matlab with the system command (<code>system('~/abin/3dMean'</code>) (as you can see I have to tell Matlab where it is located) I get the following error:</p>
  
  <pre><code>dyld: Library not loaded: /usr/X11/lib/libpng12.0.dylib
    Referenced from: /Users/kjio/abin/3dMean
    Reason: Incompatible library version: 3dMean requires version 42.0.0 or later, but libpng12.0.dylib provides version 40.0.0
  ~/abin/3dMean: Trace/breakpoint trap
  </code></pre>
  
  <p>So I checked the bash PATH in Matlab, this is the output:</p>
  
  <pre><code>system('echo $PATH')
  
  /usr/bin:/bin:/usr/sbin:/sbin
  </code></pre>
  
  <p>I tried to call the application with the following command:</p>
  
  <pre><code>system('env PATH=~/abin LD_LIBRARY_PATH=/usr/X11/lib 3dMean')
  </code></pre>
  
  <p>but that also doesn't work. I get the same error message.</p>
  
  <p>Next what I tried was to change the PATH:</p>
  
  <pre><code>setenv('PATH', [TEMP; getenv('PATH') ]);
  </code></pre>
  
  <p>In the variable TEMP were all the paths of interest out of the Terminal $PATH.
  Now I could do that</p>
  
  <pre><code>system('3dMean')
  </code></pre>
  
  <p>But I get still the same error message.</p>
  
  <p>Is there any way to update the maci64 env or how can I change the bash PATH in Matlab to overcome this problem ??</p>
  
  <p>Thanks</p>