use matlab engine

来源:互联网 发布:linux版本 编辑:程序博客网 时间:2024/04/29 23:54
Include Path
Project->Properties->C/C++ Build->Settings. Includes, /opt/MATLAB/extern/include
Libraries
We need to specify that both the "eng" and "mx" Matlab libraries should be linked with our executable. We'll also specify inside eclipse the library search path. In our installation, the libraries can be found at /opt/matlab/bin/glnx86. For 64-bit installations, replace glnx86 with glnxa64. If neither of these directories exist on your machine, then perform a find from the installation root: "find . -name libmx.so".


An alternative to using rpath would be to update the library search path in /etc/ld.so.conf. On an Ubuntu installation, we can create a matlab.conf file inside /etc/ld.so.conf.d. Inside this text file, we list the library path: /opt/matlab/bin/glnx86. After updating the file, run sudo ldconfig. You may get warnings that the .csf files in the directory are not ELF files, and this is probably not desirable for your installation
Environment
You should now be able to compile and link your application with the Matlab engine. However, before you can connect to it successfully, you need to take care of a couple environment issues:
Make sure the matlab executable is in your path. If it's not, then a simple solution is to put a symbolic link to the executable in /usr/bin: "ln -s /opt/matlab/bin/matlab /usr/bin/matlab".
The Matlab engine on Linux also requires a "c shell" to be installed. Confirm that it is installed and on the system path by running "which csh".
0 0
原创粉丝点击