C# matlab lost output after exit() call

3 次查看(过去 30 天)
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

回答(1 个)

A Jenkins
A Jenkins 2015-1-9
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...)

类别

Help CenterFile Exchange 中查找有关 Write COM Applications to Work with MATLAB 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by