http://stackoverflow.com/questions/1607933/running-matlab-function-from-java
Running MATLAB function from Java
I have an .m file in MATLAB which I would like to call from Java an get the solution as a string or whatever in Java. This sounds really simple but for some reason I can't make it work. I tried this:
but I'm not sure how I parse the answer since MATLAB opens it's own command line (in Windows). I use this, but it doesn't return anything.
also it seems that every time I call MATLAB it opens a separate window which is a problem because I'd like to run this many times. | ||||
The trick is to use the MatlabControl class http://www.cs.virginia.edu/~whitehouse/matlab/JavaMatlab.html. It's very easy to use and you can do exactly what you're trying to do (and more). | |||||||||
|
matlabcontrol is based on the same underlying MATLAB library used by MatlabControl mentioned by Jeff, but is more up to date, reliable, and documented. To get started, take a look at the walkthrough. | |||
|
JAMAL is an open source, Java RMI-based (Java Remote Method Invocation API) library that suits your needs | |||||
|
In Matlab R2016b, MathWorks added MATLAB Engine API for Java which allows to execute MATLAB code from Java. | |||
|
There exists a good Java-COM-Bridge called JaCoB (http://sourceforge.net/projects/jacob-project/) which you can use to automatically start Matlab as a COM-Server in the background. You can then follow the instructions in the Matlab help to interact with the Matlab COM Interface. Although this is a very generic interface, it provides enough flexibility to easily do a few calls to Matlab like in your case. Simply download the JaCoB package and look in the docs folder for some documentation. You also have to include the Jacob DLL in your path. | |||
|
'Matlab ' 카테고리의 다른 글
GraycoProps의 Contrast가 계산되는 방법 (0) | 2017.02.03 |
---|---|
graycomatrix가 [0,255] 사이의 이미지 입력 시 [0,8]으로 변환되는 이유 (0) | 2017.02.03 |
dist function substitution code (0) | 2017.01.13 |
윈도우 octave 옥타브 설치 (0) | 2017.01.03 |
Binary image convex hull (0) | 2016.11.02 |
-logfile
command option might help: stackoverflow.com/questions/1518072/… – Amro Oct 22 '09 at 16:28