MATLAB Engine: engEvalString() with invalid MATLAB command never returns
조회 수: 2 (최근 30일)
이전 댓글 표시
I am using the MATLAB Engine interface in an application that will allow evaluating arbitrary MATLAB inputs (it's a Mathematica/MATLAB interface).
I ran into a problem with engEvalString(): if the input given to it is an incomplete MATLAB command, the function will never return. For example, try
engEvalString(ep, "x = [1 2 3"); /* note no closing ] */
You can test this quickly using the engdemo.c example which is a ready made program that lets the user enter arbitrary MATLAB input and will evaluate it.
Is there a way to work around this? I have no control over the users of my application giving incorrect or incomplete MATLAB input. Getting back an error message would be fine, but the function simply never returns.
Note: I'm on OS X. I'm not sure if the behaviour is the same on Windows.
Additional question: Are there any other interfaces for calling MATLAB from other languages or is MATLAB Engine the only option? I found this unofficial Java solution. Is it also based on the MATLAB Engine internally?
Additional Q2: Is is possible to work around this using MATLAB code? Is there a reliable way to figure out whether a piece of text is 1. syntactically correct and 2. complete MATLAB code, and preferably test for these two things independently?
댓글 수: 0
답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Call MATLAB from C에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!