C# matlab lost output after exit() call

1 回表示 (過去 30 日間)
Scott
Scott 2015 年 1 月 9 日
回答済み: A Jenkins 2015 年 1 月 9 日
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 Center および File ExchangeStartup and Shutdown についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by