save output of command window to text files in real time
7 次查看(过去 30 天)
显示 更早的评论
Hello,
diary command allow to save the output of command window to text file, but it is only updated when the codes stops its execution. What I want is a way to save the outputs as they are appearing in the command window... Is it possible?
1 个评论
Walter Roberson
2018-9-11
Somewhere around R2013a-ish, diary was changed to flush after every line. Unfortunately I cannot seem to find a release note or posting about this so I cannot say exactly when it happened.
回答(2 个)
Image Analyst
2018-8-31
To display in the command window but not save, simply leave the semicolon off the end of the line of code.
To save something whenever you want, you can use fprintf() to write to either a file or the command window, however it's not automatic - you have to put each of the fprintf() lines into your program.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Environment and Settings 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!