redirect terminal output to file

조회 수: 149 (최근 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 CenterFile Exchange에서 Get Started with MATLAB에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by