MATLAB Engine for Java |
|||||||||
|
This library uses the C API of the MATLAB Engine to:
Please feel free to use the Bug Tracking and Feature Request system. Simple ExampleThis 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
Predefined Java commands: Example: >> x = [1:5]; >> get x [[1.0, 2.0, 3.0, 4.0, 5.0]] >> x x = 1 2 3 4 5 |