Gernot Walzl

Mat4J

MATLAB Engine for Java

This library uses the C API of the MATLAB Engine to:

http://mat4j.sourceforge.net/

Simple Example

This Java code:

MatlabEngine matlabEngine = new MatlabEngine();
matlabEngine.open(null);

matlabEngine.eval("x = sin([0:pi/2:2*pi])");
System.out.println(matlabEngine.getOutput());

DoubleMatrix doubleMatrix = (DoubleMatrix)matlabEngine.getVariable("x");
System.out.println("doubleMatrix = " + doubleMatrix.toString());

matlabEngine.close();

Prints the following to standard output:

x =

         0    1.0000    0.0000   -1.0000   -0.0000


doubleMatrix = [[0.0, 1.0, 1.2246467991473532E-16, -1.0, -2.4492935982947064E-16]]

Please have a look at the unit tests in the src package for more examples.

Test Console

mat4j.sh / mat4j.bat is a Java console application for evaluating Matlab commands.

Predefined Java commands:
exit / quit - Quits this application
get varname - Converts Matlab variables to Java objects and calls toString()
getImage hFigureVarName - Grabs a Matlab figure to a Java AWT Image

Example:

>> x = [1:5];
>> get x
[[1.0, 2.0, 3.0, 4.0, 5.0]]
>> x

x =

     1     2     3     4     5

Disclaimer

MATLAB is a registered trademark of The MathWorks, Inc.

Java and all of Oracle, Inc.'s Java-based trademarks and logos are trademarks
or registered trademarks of Oracle, Inc., in the US and/or other countries.

CONTENT.html 2016-02-05 1.77 KB
Mat4J-1.1.zip 2016-02-05 38.07 KB
lgpl-2.1.txt 2008-09-06 25.82 KB
GNU LESSER GENERAL PUBLIC LICENSE
Version 2.1, February 1999
Copyright (C) 1991, 1999 Free Software Foundation, Inc.
51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
Everyone is permitted to copy and distribute verbatim copies
mat4j-1.1-src.tar.gz 2013-12-02 41.26 KB
mat4j.jpg 2016-10-28 41.22 KB
mat4j_matlabengine-1.1-src.tar.gz 2016-02-05 17.85 KB