C# matlab lost output after exit() call

1 visualización (últimos 30 días)
Scott
Scott el 9 de En. de 2015
Respondida: A Jenkins el 9 de En. de 2015
Hi,
I'm using the COM automation server to execute some matlab code from C#. Some of the matlab code quits using exit() calls. Unfortunately it seems like these calls kill the matlab window more or less immediately and so the original MLApp.Execute() call doesn't exit cleanly, but instead throws a COMException ("remote procedure call failed") and the output string is lost.
Is there any way of (a) determining if the the COMException was due to an exit call in the matlab code, and (b) gathering the output string after the exit call has been made?
Thanks, Scott

Respuestas (1)

A Jenkins
A Jenkins el 9 de En. de 2015
In my experience, exit() kills MATLAB. I usually rewrite my code in such a way that I can just use a return from it instead so that I can collect the output string.
(I'm sure there may be reasons why you can't do this in your application. If so, then I am just commenting here so I will remember to look back if other people have better answers...)

Categorías

Más información sobre Write COM Applications to Work with MATLAB en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by