How to use Matlab from JAVA without using the Matlab Compiler

862 Views Asked by At

I have used the JavaBuilder that comes with Matlab so that I can use Matlab functions from my JAVA program. In order to do that, I need to have the Matlab Compiler installed. Is there a way to do use Matlab from JAVA, but without the need to have the Matlab Compiler? I mean, can Matlab create the JAVA version of the matlab function (translate from matlab to JAVA)?

Thank you

2

There are 2 best solutions below

0
On

matlabcontrol is a Java API which will allow you to call MATLAB from Java. It does not make use of any compiler.

You can either call MATLAB from within MATLAB or from outside MATLAB in which case an instance of MATLAB is launched and connected to. It allows for invoking eval and feval in MATLAB and returning the results to MATLAB. The walkthrough explains with examples how to do this.

0
On

If you have Matlab (but you don't have builderJA) then you can use matlabcontrol for using matlab functions in java.(There might be other alternatives too, but I don't know)

If you don't have Matlab at all then you can "create the java version of the matlab function" in some other computer having Matlab and builderJA installed, and use the jar files in your own computer. You only need to have MCR (Matlab Compiler Runtime- Its FREE) installed on your computer.

Strickly answering your question:

Is there a way to do use Matlab from JAVA, but without the need to have the Matlab Compiler?

The answer is:

Yes, you can use it. Using matlabcontrol (A java API to interact with Matlab).