matlab search path

What Is the MATLAB Search Path
The search path, or path is a subset of all the folders in the file system. MATLAB® software uses the search path to efficiently locate files used with MathWorks® products. MATLAB can access all files in the folders on the search path.
How MATLAB Stores the Search Path
MATLAB saves the search path information in the pathdef.m file. The pathdef.m file is a series of full path names, one for each folder on the search path, separated by a semicolon (;).
By default,  pathdef.m is in  $matlabroot/toolbox/local.

改變上下文中的search path:
Syntax:
path
path('newpath')
path(path,'newpath')
path('newpath',path)
p = path
Description
path displays the MATLAB® search path, which is stored in pathdef.m.
path('newpath')      changes the search path to newpath, where newpath is a string array of folders.
path(path,'newpath')   adds the newpath folder to the end of the search path. If newpath is already on the search path, thenpath(path, 'newpath') moves newpath to the end of the search path.
path('newpath',path)   adds the newpath folder to the top of the search path. If newpath is already on the search path, thenpath('newpath', path) moves newpath to the top of the search path. To add multiple folders in one statement, instead use addpath.
p = path          returns the search path to string variable p.
例子:
path('/opt/lampp/lib', path), 便是把/opt/lampp/lib加入到search path的前面。
 

Specifying the Java Library Path
Java classes can dynamically load native methods using the Java method java.lang.System.loadLibrary("LibFile"). In order for the JVM software to locate the specified library file, the directory containing it must be on the Java Library Path. This path is established when MATLAB launches the JVM software at startup, and is based on the contents of the file
$matlabroot/toolbox/local/librarypath.txt
(where $matlabroot is the MATLAB root directory represented by the MATLAB keyword matlabroot).
You can augment the search path for native method libraries by editing the librarypath.txt file. Follow these guidelines when editing this file:
    Specify each new directory on a line by itself.
    Specify only the directory names, not the names of the DLL files. The LoadLibrary call does this for you.
To simplify the specification of directories in cross-platform environments, you can use any of these macros: $matlabroot, $arch, and $jre_home.

=================================================================================
改變matlab的 load library path: 
第一種方法:改變library load path:
export LD_LIBRARY_PATH=/opt/lampp/lib
若採用這種方法,須要創建一個可執行文件 /usr/local/bin/matlab,內容爲:
#!/bin/bash
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/opt/lampp/lib
cd /opt/soft/matlab
# 這裏不能採用後臺執行的方式,否則matlab 不能啓動, 也即不能加 &
./bin/matlab
 

第二種方法:還有另一種方法在編程上下文定義load library path:(這個方法好像無論用)
getenv('LD_LIBRARY_PATH')
setenv('LD_LIBRARY_PATH', [getenv('LD_LIBRARY_PATH') ':/opt/lampp/lib']);java

相關文章
相關標籤/搜索