Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
using_matlab_from_prolog [2013/02/04 12:13] – created tenorth | using_matlab_from_prolog [2014/08/08 09:36] (current) – admin | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | *Use the MATLAB-Prolog interface | + | ====== Using Matlab |
- | * set the following values in the MAKEFILE | + | |
- | | + | \\ |
- | export MLARCH=glnxa64 | + | **Note: This page describes experimental code that has not been used in a while. Please try it at your own risk. ** |
- | export MLLIBS=-leng -lmx -lmat -licuuc -licudata -licui18n -lz -lreadline | + | \\ |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | *generate a new file and call it: setPathMatlab.m this file should have the following: | + | The Matlab-Prolog interface [[http:// |
- | | + | You need to set the following values in the Makefile |
- | | + | |
- | * move/copy the new file " | + | export MATLAB=/usr/ |
+ | export MLARCH=glnxa64 | ||
+ | export MLLIBS=-leng -lmx -lmat -licuuc -licudata -licui18n -lz -lreadline | ||
+ | export SO=so | ||
+ | export INCLUDES= | ||
+ | export PLLD=/ | ||
+ | export INSTALL_LIB_TO=~/work/owl/lib | ||
+ | export INSTALL_PL_TO=~/ | ||
+ | export INSTALL_FLAGS=' | ||
- | *Enter the file plml.cpp and add the following (~line 179) | + | Generate a new file and call it: setPathMatlab.m this file should have the following: |
+ | |||
+ | p=genpath('/ | ||
+ | addpath(p); | ||
+ | |||
+ | Then move/copy the new file " | ||
+ | |||
+ | Enter the file plml.cpp and add the following (~line 179) | ||
if (ep) { | if (ep) { | ||
Line 28: | Line 35: | ||
- | * configure, make, make install | + | Configure, make, make install. Set the library path to include the MATLAB directories |
+ | export LD_LIBRARY_PATH=/ | ||
- | * set the library path to include the MATLAB directories | + | Move to the ~/work/owl directory, start Prolog and run the following commands |
- | | + | ?- assert(user: |
- | + | assert(user: | |
- | * move to the ~/work/owl directory | + | true. |
- | + | ||
- | * start Prolog and run the following commands | + | ?- use_module(library(plml)). |
- | ?- assert(user: | + | % hostname set to atradig131 |
- | | + | % library(hostname) compiled into hostname 0.03 sec, 403,152 bytes |
- | + | % | |
- | ?- use_module(library(plml)). | + | % library(utils) compiled into utils 0.01 sec, 65,408 bytes |
- | % hostname set to atradig131 | + | % library(flists) compiled into flists 0.00 sec, 10,456 bytes |
- | | + | % library(plml) compiled into plml 0.08 sec, 619,872 bytes |
- | | + | true. |
- | | + | |
- | | + | ?- ml_open(ml). |
- | % library(plml) compiled into plml 0.08 sec, 619,872 bytes | + | Matlab engine (ml) open. |
- | | + | true. |
- | + | ||
- | ?- ml_open(ml). | + | ?- float(A)===2*pi. |
- | | + | A = 6.28319. |
- | | + | |
- | + | ||
- | ?- float(A)===2*pi. | + | |
- | A = 6.28319. | + | |
- | * NOTE: Just in case you have the following error: | + | NOTE: In case you have the following error: |
?- ml_open(ml). | ?- ml_open(ml). | ||
ERROR: Unhandled exception: Unknown message: open engine failed | ERROR: Unhandled exception: Unknown message: open engine failed | ||
- | * This means that you need to do the following: | + | This means that you need to do the following: |
$ sudo apt-get install csh. | $ sudo apt-get install csh. | ||
- | By default c-shell is installed in /bin/csh. | + | By default c-shell is installed in /bin/csh. That is necessary because you need to have C shell installed in your system as /bin/csh for the matlab engine program to function correctly. You can use any shell, but just that C shell has to be there in the system so that the engine program can use it. |
- | That is necessary because you need to have C shell installed | + | |
- | in your system as /bin/csh for the matlab engine program | + | |
- | to function correctly. You can use any shell, but just that | + | |
- | C shell has to be there in the system so that the engine | + | |
- | program can use it. | + |