Error problem with evalString
조회 수: 1 (최근 30일)
이전 댓글 표시
Hello, I have a problem. I have a double matrix in java, when I pass it to matlab for some calculs I got this error : cannot get array res for matlab workspace. Can you help me please?
The java code:
double [][]m1={{1, 2, 3},{4, 5, 6}};
double [][]m2={{1, 2, 3},{1, 2, 3}};
JMatLink engine1 = new JMatLink();
engine1.engOpen();
engine1.engOutputBuffer();
engine1.engEvalString("res=fproductMatrix("+m1+","+m2+");");
System.out.println("read output buffer of matlab ");
double [][] produit= engine1.engGetArray("res");
engine1.engClose();
Knowing that fproductMatrix (.m file ) is a matlab function which return the product of two matrix. Thank you in advance.
댓글 수: 0
답변 (1개)
Samuel Gray
2021년 10월 7일
I don't see any documentation that says that evalstring needs a buffer. I'd try running it with setvisible and without engoutputbuffer just to see what happens without having to pass the text back. Then run it before and after configuring the output buffer, at least in C you can't just call it without some parameters to indicate the buffer size and the termination location.
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Platform and License에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!