Azzera filtri
Azzera filtri

engGetVariable crashes after MATLAB has quit

1 visualizzazione (ultimi 30 giorni)
Szabolcs
Szabolcs il 11 Feb 2013
Commentato: Samuel Gray il 10 Mar 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 Commento
Samuel Gray
Samuel Gray il 10 Mar 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

Accedi per commentare.

Risposte (0)

Categorie

Scopri di più su Loops and Conditional Statements in Help Center e File Exchange

Prodotti

Community Treasure Hunt

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

Start Hunting!

Translated by