Matlab Java Engine API error

1 回表示 (過去 30 日間)
Manuel Rios
Manuel Rios 2017 年 2 月 20 日
回答済み: Bo Li 2017 年 3 月 15 日
I was trying to connect Matlab with Java using the Matlab Engine, I followed the examples of this web page: https://www.mathworks.com/help/matlab/matlab_external/execute-matlab-functions-from-java.html?requestedDomain=www.mathworks.com
After adding the requiered references and writting down this code:
import com.mathworks.engine.*;
public class CNN
{
public static void main(String[] args) throws Exception{
MatlabEngine eng = MatlabEngine.startMatlab();
double[] a = {2.0 ,4.0, 6.0};
double[] roots = eng.feval("sqrt", a);
eng.close();
}
}
Eclipse shows an error on feval function
It seems that I am using wrong arguments on the feval function. But I am using the code posted on the reference page of mathworks.
All the other example codes do not compile.
what am I doing wrong ? if the documentation is wrong how can I know how to use this function?

回答 (1 件)

Bo Li
Bo Li 2017 年 3 月 15 日
This looks like an Eclipse issue. The example code should just compile if you ignore the hints.

カテゴリ

Help Center および File ExchangeCall MATLAB from Java についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by