TUHH > Servicebereiche > Rechenzentrum > Examples of the MATLAB API

Zur Nutzung der Programmierschnittstelle mit Matlab R2009a unter Suse 11

Ein Beispielverzeichnis befindet sich im Installationsbereich, 
z.B. unter: 

/usr/local/matlab/extern/examples/compiler

Das Verzeichnis kann in ein eigenes Verzeichnis kopiert werden. 
Vor den Compilertests sind einige Umgebungsvariablen zu setzen, 
z.B. mit der bash:

export MATLABROOT=/usr/local/matlab
export PATH=$MATLABROOT/bin:$PATH
export LD_LIBRARY_PATH=$MATLABROOT/bin/glnxa64:$MATLABROOT/sys/os/glnxa64

Wenn nicht die GNU-Compiler des Systems genutzt werden sollen, 
ist engopts.sh abzuwandeln.

Zudem ist die LD_LIBRARY_PATH - Variable zu ergaenzen, da auch im 
Arbeitsverzeichnis Libraries erzeugt und gebraucht werden:

export LD_LIBRARY_PATH=/home/rztit/prog/matlab/examples/compiler:$LD_LIBRARY_PATH

Nunmehr sollten die Tests durchlaufen:

gmake -f Makefile MATLABROOT=/usr/local/matlab bnt_exes

*********** testing mrank ***********
./mrank

r =

     1
     2
     3
     3
     5

*********** testing hello ***********
./hello
Hello, World
*********** testing flames ***********
./flames
*********** testing magicsquare 4 ***********
./magicsquare 4

m =

    16     2     3    13
     5    11    10     8
     9     7     6    12
     4    14    15     1

*********** testing mrankp ***********
./mrankp
     1
     2
     3
     3
     5
     5
     7
     3
     9
     7
    11
     3

*********** testing multargp ***********
./multargp
The first return value is:
   6.2832 +34.5575i  25.1327 +25.1327i  43.9823 +43.9823i
  12.5664 +34.5575i  31.4159 +31.4159i  50.2655 +28.2743i
  18.8496 +18.8496i  37.6991 +37.6991i  56.5487 +28.2743i

The second return value is :
  143.4164

*********** testing matrixdriver ***********
./matrixdriver
The value of added matrix is:
2.00    8.00    14.00
4.00    10.00   16.00
6.00    12.00   18.00

The value of the multiplied matrix is:
30.00   66.00   102.00
36.00   81.00   126.00
42.00   96.00   150.00

The eigenvalues of the first matrix are:
16.12   -1.12   -0.00

*********** testing triangle ***********
./triangle
Calculated 7500 points
*********** testing collect ***********
./collect
*********** testing trianglep ***********
./trianglep

Calculated 7500 points
*********** testing matrixdriverp ***********
./matrixdriverp
The value of added matrix is:
     2     8    14
     4    10    16
     6    12    18
The value of the multiplied matrix is:
    30    66   102
    36    81   126
    42    96   150
The eigenvalues of the first matrix are:
   16.1168
   -1.1168
   -0.0000
Weitere Infos sind den Manuals bzw. dem Matlab-Help und der README-Datei im Beispielverzeichnis zu entnehmen.