问题
I'm writing an application which does image processing using matlab and later displays the result using Java's Interface. Due to certain reasons I've to use both Java and Matlab.
How can I use the matlab function in java ?? How to create and access the interface.
回答1:
matlabcontrol is a Java API which will allow you to call your image processing functions or scripts and return the results to Java. To get started, take a look at the walkthrough.
回答2:
MATLAB Builder JA is one option to use MATLAB code in Java. This is a non free toolbox for creating a jar
file from MATLAB code in order to be import
ed to Java
. Take care of the restrictions concerning jar
file creation.
Using Java classes inside MATLAB is much easier, as you can instantiate Java classes in MATLAB code. Undocumented Matlab is one valuable resource for Java integration in MATLAB.
Check Using Sun Java Classes in MATLAB Software for the official information provided by The MathWorks.
回答3:
A quick google brought up this http://j-integra.intrinsyc.com/support/com/doc/other_examples/Matlab.htm
Alternatively, can you execute your matlab function from the command line? If so you can use
Runtime.getRuntime().exec("your matlab function")
回答4:
As of R2016b you can use official MATLAB Engine API for Java, which seems to allow same functionality as matlabcontrol.
来源:https://stackoverflow.com/questions/5003388/executing-a-matlab-function-using-java