Is it possible to capture partial output in the case of an error during evalc?

5 ビュー (過去 30 日間)
Jesse Hopkins
Jesse Hopkins 2012 年 1 月 16 日
Looking to see if it is possible to capture partial output from evalc if it never returns. Consider:
try
str = evalc('disp(''HERE''); error(''something bad happened''); disp(''NOW HERE'')');
catch ME
end
In the catch block, the variable "str" is not defined because evalc never returned. However, just before the error, we would've seen "HERE" displayed using plain "eval". Is there any way to get that information in the catch block with evalc?
  2 件のコメント
Oleg Komarov
Oleg Komarov 2012 年 1 月 16 日
What do you need this functionality for? If you try to describe the general problem you want to solve we might come up with an alternative (and easier to debug, interpret, read) solution.
Jesse Hopkins
Jesse Hopkins 2012 年 6 月 25 日
Hi, I know its been a while since I've commented on this, but I've been off doing other things and am now returning to this problem. The reason I need this functionality is that I'm trying to put together a testing framework that can operate in a "silent" mode, capturing all relevant output and figures to a report. I would like the report to include command line output of individual test cases. When a test case fails due to an error, any command line output that might have been captured via evalc is lost. I suppose that diary may be another method to try as well.

サインインしてコメントする。

回答 (0 件)

カテゴリ

Help Center および File ExchangePerformance and Memory についてさらに検索

タグ

製品

Community Treasure Hunt

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

Start Hunting!

Translated by