Mat4J
MATLAB Engine for Java
This library uses the C API of the MATLAB Engine to:
- put variables from Java to Matlab
- evaluate Matlab commands
- get results from Matlab to Java
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 | source | 2022-05-25 | 1.8 KB |
Mat4J-1.1.zip | sha256 | 2016-02-05 | 38.1 KB |
lgpl-2.1.txt | 2008-09-06 | 25.8 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 | sha256 | 2013-12-02 | 41.3 KB |
mat4j.jpg | 2016-10-28 | 41.2 KB | |
mat4j_matlabengine-1.1-src.tar.gz | sha256 | 2016-02-05 | 17.9 KB |