redirect terminal output to file

171 ビュー (過去 30 日間)
Edward Umpfenbach
Edward Umpfenbach 2012 年 5 月 22 日
編集済み: Paul Wintz 2021 年 10 月 5 日
I have a commercial solver that I use in Matlab. It internally prints information to the Matlab terminal and I have no control over it. I want to redirect the output to a text file instead. What is the best way to do this? Pretty sure fprintf won't help me.
  1 件のコメント
Oleg Komarov
Oleg Komarov 2012 年 5 月 22 日
Why not? Also, your question is too vague. What is a commercial solver that you use IN Matlab? A function?

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

採用された回答

Walter Roberson
Walter Roberson 2012 年 5 月 22 日
  2 件のコメント
Sanjay Manohar
Sanjay Manohar 2020 年 1 月 16 日
Good answer. But: Is there also any way to actually redirect - i.e. to stop output to the console at the same time?
B Treeby
B Treeby 2020 年 5 月 12 日
One option is to use evalc to redirect output to a variable instead of the console.

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

その他の回答 (1 件)

Paul Wintz
Paul Wintz 2021 年 10 月 5 日
編集済み: Paul Wintz 2021 年 10 月 5 日
As @B Treeby said in a comment above, you can hide all output from a function call by using evalc.
evalc('fprintf(''Hello, World!'')');
Note that the semicolon is important, here, because evalc returns the printed text, so without the semicolon you end up printing the output.

カテゴリ

Help Center および File ExchangeGet Started with MATLAB についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by