I wanted to add a path to MATLAB to allow me to run external programs while in MATLAB. Copied straight from the MATLAB user guide:
Modify the UNIX System Path that MATLAB Uses. Add the folders to the system path from the shell. The exact steps depend on your shell. This is an example using sh:
- At the system command prompt, type
export PATH="$PATH:<myfolder>"where <myfolder> is the folder that contains the program you want to run.
- Start MATLAB.
- In the MATLAB Command Window, type
!echo $PATHThe folder containing the file is added to the system path that MATLAB uses. This change applies only to the current session of the terminal window.
Automatically Modify the System Path When MATLAB Starts. If you want to add a folder to the PATH environment variable each time you start MATLAB, perform these steps:
- In a text editor, open the file MATLAB/bin/matlab. This file is used to start MATLAB.
- Add this line to the beginning of the matlab file
export PATH="$PATH:<myfolder>"where <myfolder> is the folder you want to add to the path.
If you run a tsch shell instead of a bash shell, use setenv instead of export.
- Save the file.
The matlab file will modify the PATH environment variable, and then start MATLAB.