save output of command window to text files in real time

조회 수: 5 (최근 30일)
kira
kira 2018년 8월 31일
댓글: Walter Roberson 2018년 9월 11일
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
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개)

Steven Lord
Steven Lord 2018년 8월 31일
Start MATLAB with the -logfile option.
  댓글 수: 1
kira
kira 2018년 8월 31일
Ok, but that will save the entire session, I just want to save a particular code...

댓글을 달려면 로그인하십시오.


Image Analyst
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.
  댓글 수: 1
kira
kira 2018년 8월 31일
yup, this is what i have so far, but command windows outputs are not saved...

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Entering Commands에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by