
Running Functions and Programs, and Entering Variables
UNIX System Path and Running UNIX Programs from MATLAB
To run a UNIX program from MATLAB if its directory is not on the UNIX
system path MATLAB uses, take one of the actions described here.
Change Current Directory in MATLAB. Change the current directory in
MATLAB to the directory that contains the p rogram you want to run.
Modify the UNIX System Path MATLAB Uses. Add the directories to the
system path from the shell. The exact steps depend on your shell. This is
an example using sh:
1 At the system command prompt, type
export PATH="$PATH:<mydirectory>"
where <mydirectory> is the directory that contains the program you want
to run.
2 Start M ATLAB.
3 In M ATLAB, type
!echo $PATH
The directory containing the file is added to the system path that MATLAB
uses. This change a pplies only to the current session of the terminal window.
Automatically Modify System Pa th at MATLAB Startup. If you want
to add a directory to the
PATH environment variable each time you start
MATLAB, perform these steps:
1 In a tex t e ditor, open the f ile MATLAB/bin/matlab.Thisfileisusedto
start M ATLAB.
2 Add this line to the beginning of the matlab file
export PATH="$PATH:<mydirectory>"
where <mydirectory> is the directory you want to add to the path.
Ifyourunatschshellinsteadofabashshell,use
setenv instead of export.
3-11
Kommentare zu diesen Handbüchern