Borrar filtros
Borrar filtros

engGetVariable crashes after MATLAB has quit

1 visualización (últimos 30 días)
Szabolcs
Szabolcs el 11 de Feb. de 2013
Comentada: Samuel Gray el 10 de Mzo. de 2022
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 comentario
Samuel Gray
Samuel Gray el 10 de Mzo. de 2022
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

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Más información sobre Loops and Conditional Statements en Help Center y File Exchange.

Etiquetas

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by