Project

General

Profile

Morph-M Matlab - How to use Morph-M with Matlab » History » Version 10

Serge Koudoro, 12/29/2008 01:52 PM

1 1 Serge Koudoro
h1. How to use Morph-M with Matlab 
2
3 5 Serge Koudoro
h2{color:#8B0000}. Introduction
4 1 Serge Koudoro
5 10 Serge Koudoro
The Matlab capabilities can be extended through domain specific software packages called Matlab toolboxes. A typical Matlab toolbox is a directory structure which contains new data structures and function definitions that extend Matlab's capabilities to a new science or engineering area. A Matlab toolbox user simply copies the toolbox directory structure and tells Matlab where the toolbox is located. The toolbox defined functions and datatypes then become available from Matlab. Java is very extensively supported in Matlab. Since we have Java wrappers in Morph-M, we can quickly get access to all of Morph-M in Matlab using the Java wrappers.
6 1 Serge Koudoro
7 10 Serge Koudoro
8 1 Serge Koudoro
h2{color:#8B0000}. Setting up Java-Wrapped Morph-M in Matlab
9 4 Serge Koudoro
10 10 Serge Koudoro
We need to tell Matlab where to find the Java class files for Morph-M and the Matlab load library work-around.
11 1 Serge Koudoro
This can be done dynamically from the Matlab command prompt, but these commands will need to be applied each time Matlab is started:
12
13 10 Serge Koudoro
 >> javaaddpath('insert-your-path-to-the-Morph-M-build-directory-here/bin/Morpheejava.jar')
14 1 Serge Koudoro
 >> javaaddpath('insert-your-path-to-the-directory-containing-LoadLibrary.class-here');
15
16 10 Serge Koudoro
There are two alternatives for a permanent addition to the Matlab Java class path. The first method requires root or administrative access to the Matlab installation on your system (if Matlab is installed in your local Unix directory you can also use this method). This change will apply to all users who access this Matlab installation. The second method is to modify a local copy of the *classpath.txt* file in the local users Matlab startup directory.
17 1 Serge Koudoro
18
For method one: as root (Unix) or as an account with administrator priveledges (Windows), execute the following from within Matlab, or directly edit the classpath.txt file with any text editor:
19
20
edit([matlabroot '/toolbox/local/classpath.txt']);
21
22
For method two: make a copy of $matlabroot/toolbox/local/classpath.txt into your Matlab startup directory and edit that copy (on Unix the Matlab startup directory is in your home directory under .matlab/R2008a).
23
24
Add the following lines to your classpath.txt (system or local copy):
25
26 10 Serge Koudoro
insert-your-path-to-Morph-M-build-directory/Morpheejava.jar
27 1 Serge Koudoro
insert-your-path-to-the-directory-containing-LoadLibrary.class-here
28
29 10 Serge Koudoro
Next, we need to tell Matlab where to find the dynamic libraries for Morph-M by editing *librarypath.txt*. Again, there are two options:
30
* Option one requires root or adiminstrator priveledges and changes the Matlab search path for all users of the Matlab installation: as root (Unix) or as an account with administrator piveledgles (Windows), execute the following from within Matlab, or directly edit the librarypath.txt file with any text editor: @edit([matlabroot '/toolbox/local/librarypath.txt']);@ . Add the following line to librarypath.txt : path-to-the-Morph-M-build-directory (e.g: $matlabroot/morphm/dll)
31 1 Serge Koudoro
32 10 Serge Koudoro
* Options two modifies a local copy of *librarypath.txt* file and applies to the local user: make a copy of $matlabroot/toolbox/local/librarypath.txt your Matlab startup directory and edit that copy (on Unix the Matlab startup directory is in your home directory under .matlab/R2008a). Add the following line to librarypath.txt : path-to-the-Morph-M-build-directory (e.g: $matlabroot/morphm/dll)
33 1 Serge Koudoro
34 6 Serge Koudoro
h2{color:#8B0000}. Using Java-Wrapped Morph-M within Matlab
35 1 Serge Koudoro
36 6 Serge Koudoro
In order to use Morph-M stuff in Matlab, first execute
37 8 Serge Koudoro
<pre>LoadLibrary.loadLibrary('Morpheejava');</pre>
38 9 Serge Koudoro
All functions available are loaded, Now we are ready to go. You can see below some example: (For more example, [[Morph-M within Matlab Examples|click Here]])  
39 1 Serge Koudoro
40 5 Serge Koudoro
41 8 Serge Koudoro
h2{color:#8B0000}. Settings and Compabilities problems
42 5 Serge Koudoro
43 8 Serge Koudoro
h2{color:#8B0000}. Matlab Morph-M Toolbox Release