redirect terminal output to file

124 visualizaciones (últimos 30 días)
Edward Umpfenbach
Edward Umpfenbach el 22 de Mayo de 2012
Editada: Paul Wintz el 5 de Oct. de 2021
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 comentario
Oleg Komarov
Oleg Komarov el 22 de Mayo de 2012
Why not? Also, your question is too vague. What is a commercial solver that you use IN Matlab? A function?

Iniciar sesión para comentar.

Respuesta aceptada

Walter Roberson
Walter Roberson el 22 de Mayo de 2012
  2 comentarios
Sanjay Manohar
Sanjay Manohar el 16 de En. de 2020
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 el 12 de Mayo de 2020
One option is to use evalc to redirect output to a variable instead of the console.

Iniciar sesión para comentar.

Más respuestas (1)

Paul Wintz
Paul Wintz el 5 de Oct. de 2021
Editada: Paul Wintz el 5 de Oct. de 2021
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.

Categorías

Más información sobre Entering Commands en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by