필터 지우기
필터 지우기

engGetVariable crashes after MATLAB has quit

조회 수: 1 (최근 30일)
Szabolcs
Szabolcs 2013년 2월 11일
댓글: Samuel Gray 2022년 3월 10일
When using the MATLAB Engine interface, if the MATLAB process quits, engGetVariable(ep, "name") simply crashes (at least on OS X it does).
What is the best way to deal with this problem?
The only solution I can see is to do
engEvalString(ep, "")
to test whether MATLAB is still running before each single engGetVariable(). Is there a better way? I wish engGetVariable were smart enough to handle this situation and just return NULL if MATLAB is not running.
  댓글 수: 1
Samuel Gray
Samuel Gray 2022년 3월 10일
you could run a test string against the Matlab workspace pointed to by the engine pointer
sprintf(tststr,"whos('myvar');\n") (or ~exists('myvar','var'))
engEvalStr(tststr...)
getBuffer (I forget the exact call)
get the console buffer string and see if it has the variable that you're looking to copy with GetVariable

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

태그

제품

Community Treasure Hunt

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

Start Hunting!

Translated by