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
改变上下文中的search path:
Specifying the Java Library 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的前面。
例子:
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:
=================================================================================
改变matlab的 load library path:
第一种方法:改变library load path:
export LD_LIBRARY_PATH=/opt/lampp/lib
若采用这种方法,需要建立一个可执行文件 /usr/local/bin/matlab,内容为:
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']);
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
支付宝扫一扫捐赠
支付宝扫一扫捐赠
微信公众号: 共鸣圈
欢迎讨论,邮件: 924948$qq.com 请把$改成@
QQ群:263132197
QQ: 924948