Clear Filters
Clear Filters

Call MATLAB from java

2 views (last 30 days)
Lochana Prasadi
Lochana Prasadi on 18 May 2016
Answered: Malcolm Lidierth on 19 May 2016
Hi!
I'm developing a software to interact with piano melodies in java using Netbeans IDE 8.0.2. There is a feature in my system to get a piano melody audio file in wav format and output the notations. In order to identify notes in the melody I used MATLAB 7.12.0 (R2011a) and already I can get the output. Now I want to execute that MATLAB commands in my java interface. So how can I try this? I saw there are some available libraries called MatlabControl and javabuilder. But I don't have a clear path to use those libraries correctly. I'm so glad if anyone can guide me.
Thanks in advance.

Accepted Answer

Malcolm Lidierth
Malcolm Lidierth on 19 May 2016
"I'm developing a software to interact with piano melodies in java using Netbeans IDE 8.0.2"
[1] There may be no need to do anything more than compile your code, add the jar to MATLAB's java path (using javaaddpath) and call into your code from MATLAB. In this case, MATLAB provides your work environment but you have access to the java code from it. Your code and MATLAB share a Java Virtual Machine, so all is easy.
[2] MatlabControl let's you run a java application but invoke and use the MATLAB engine from inside it. Typically, you will need pretty good knowledge of both MATLAB and Java. Java then provides your front-end with MATLAB being used typically for number crunching.
[3] Builder tools from TMW let you deploy a mixed Java/MATLAB code base as an app and, if you have the appropriate license, to deploy to end-users who do not have MATLAB.
Of these approaches, [1] is easiest/cheapest and ou can put a Java GUI on the front-end using AWT/Swing/JavaFX.
ML

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!