|
Prev: I need more information about the resample command
Next: Calc of sun/moon angle above horizon script?
From: Fran?ois on 19 Jun 2008 07:53 I am trying to set the $PATH in MATLAB in order to call external functions in the shell, i.e., !convert. In the MATLAB command window, >> !echo $PATH returns >> /usr/bin:/bin:/usr/sbin:/sbin I would like to add other locations to this. My xterm is configured as a login-shell, and correctly reads from my .profile file. Does anyone know where this path can be modified? Many thanks in advance.
From: Doug Schwarz on 19 Jun 2008 16:01 In article <g3dhat$pbm$1(a)fred.mathworks.com>, "Fran?ois " <notpublic(a)switch.ch> wrote: > I am trying to set the $PATH in MATLAB in order to call > external functions in the shell, i.e., !convert. > > In the MATLAB command window, > >> !echo $PATH > returns > >> /usr/bin:/bin:/usr/sbin:/sbin > > I would like to add other locations to this. > My xterm is configured as a login-shell, and correctly reads > from my .profile file. Does anyone know where this path can > be modified? Many thanks in advance. You need to create a plist file. Make a plain text file like this: <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>PATH</key> <string>/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin</string> </dict> </plist> (Watch for wrapped lines; the file above has 8 lines, each beginning with '<'.) Substitute your desired $PATH between <string> and </string>. Save the file in ~/.MacOSX/environment.plist where ~ is your home directory. I'm not sure when the OS reads that file so you'll probably have to restart MATLAB, maybe log out and back in, maybe even reboot. Anyway, once you're done, all those directories should be available from a shell spawned by MATLAB. -- Doug Schwarz dmschwarz&ieee,org Make obvious changes to get real email address.
From: Fran?ois on 19 Jun 2008 18:10 Doug Schwarz <see(a)sig.for.address.edu> wrote in message <see- 310904.16012419062008(a)news.motzarella.org>... > In article <g3dhat$pbm$1(a)fred.mathworks.com>, > "Fran?ois " <notpublic(a)switch.ch> wrote: > > > I am trying to set the $PATH in MATLAB in order to call > > external functions in the shell, i.e., !convert. > > > > In the MATLAB command window, > > >> !echo $PATH > > returns > > >> /usr/bin:/bin:/usr/sbin:/sbin > > > > I would like to add other locations to this. > > My xterm is configured as a login-shell, and correctly reads > > from my .profile file. Does anyone know where this path can > > be modified? Many thanks in advance. > > > You need to create a plist file. Make a plain text file like this: > > > > <?xml version="1.0" encoding="UTF-8"?> > <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> > <plist version="1.0"> > <dict> > <key>PATH</key> > <string>/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin</string> > </dict> > </plist> > > > > (Watch for wrapped lines; the file above has 8 lines, each beginning > with '<'.) > > Substitute your desired $PATH between <string> and </string>. > > Save the file in ~/.MacOSX/environment.plist where ~ is your home > directory. I'm not sure when the OS reads that file so you'll probably > have to restart MATLAB, maybe log out and back in, maybe even reboot. > Anyway, once you're done, all those directories should be available > from a shell spawned by MATLAB. > > -- > Doug Schwarz > dmschwarz&ieee,org > Make obvious changes to get real email address. Thanks for the fast answer! This did the trick; I would never have guessed it...
From: Joaquim Luis on 19 Jun 2008 21:20 "Fran?ois " <notpublic(a)switch.ch> wrote in message <g3dhat$pbm$1(a)fred.mathworks.com>... > I am trying to set the $PATH in MATLAB in order to call > external functions in the shell, i.e., !convert. > > In the MATLAB command window, > >> !echo $PATH > returns > >> /usr/bin:/bin:/usr/sbin:/sbin > > I would like to add other locations to this. > My xterm is configured as a login-shell, and correctly reads > from my .profile file. Does anyone know where this path can > be modified? Many thanks in advance. I find incomprehensible why OS X do not behave like linux (it ignores what we set in the .profile or alike) Another solution is to use ML itself to do it pato = getenv('PATH'); setenv('PATH',[pato ':/usr/local/bin'])
From: Doug Schwarz on 20 Jun 2008 09:13
In article <g3f0ki$1tk$1(a)fred.mathworks.com>, "Joaquim Luis" <jluis@--ualg--.pt> wrote: > "Fran?ois " <notpublic(a)switch.ch> wrote in message > <g3dhat$pbm$1(a)fred.mathworks.com>... > > I am trying to set the $PATH in MATLAB in order to call > > external functions in the shell, i.e., !convert. > > > > In the MATLAB command window, > > >> !echo $PATH > > returns > > >> /usr/bin:/bin:/usr/sbin:/sbin > > > > I would like to add other locations to this. > > My xterm is configured as a login-shell, and correctly > reads > > from my .profile file. Does anyone know where this path > can > > be modified? Many thanks in advance. > > I find incomprehensible why OS X do not behave like linux > (it ignores what we set in the .profile or alike) > > Another solution is to use ML itself to do it > > pato = getenv('PATH'); > setenv('PATH',[pato ':/usr/local/bin']) Thanks for the reminder about setenv -- I had forgotten that it existed! Using it is more straightforward than the convoluted plist method. By the way, the plist file is how you set system-wide environment variables. The Terminal application (and xterms under X11) do read ..profile. If you start a new bash shell from an existing bash shell, doesn't the new one just inherit all its environment variables from the parent shell and not re-read .profile? If so, then that's essentially how MATLAB works -- the spawned shell is not reading .profile. Thanks again for the setenv tip. -- Doug Schwarz dmschwarz&ieee,org Make obvious changes to get real email address. |