How do we save command window output to a text file?
조회 수: 90 (최근 30일)
이전 댓글 표시
How do we save command window output to a text file? The professor does not want us to use fprintf function to write data to text file. I want the text file name to be 'DailySummaries'. I have done this currently but it does not save it as a .txt file
diary on
diary('DailySummaries')
disp(strcat('Day',{' '},num2str(data(i).elapsedtime(3)),{' '},' Healthy People = ',{' '},num2str(data(i).healthy)))
disp(strcat('Day',{' '},num2str(data(i).elapsedtime(3)),{' '},' Infected People = ',{' '},num2str(data(i).infected)))
disp(strcat('Day',{' '},num2str(data(i).elapsedtime(3)),{' '},' Sick People = ',{' '},num2str(data(i).sick)))
disp(strcat('Day',{' '},num2str(data(i).elapsedtime(3)),{' '},' Recovered People = ',{' '},num2str(data(i).recovered)))
diary off
댓글 수: 0
답변 (1개)
Walter Roberson
2021년 3월 23일
diary does create a text file. However, diary() does not automatically add any file extension, so your File Explorer does not know how to open the file.
diary('DailySummaries.txt')
댓글 수: 2
navanit dubey
2021년 3월 24일
sir please see to it too https://in.mathworks.com/matlabcentral/answers/782028-how-to-save-the-matrix-value-of-bmp-image
참고 항목
카테고리
Help Center 및 File Exchange에서 String Parsing에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!