Creating a text file through Matlab
조회 수: 4 (최근 30일)
이전 댓글 표시
Hello,
I want to save parameters from a program that I am running to a separate text file, while the program is in progress.
For example, if my program defines (ycent,xcent)=(10,10) I want a text file to be created that writes
"(ycent,xcent)=(10,10)" on the first line.
I want to be able to keep adding data like this to the file, while the program is still running.
Does anyone know how to do something like this?
Thank you in advance for your replies!
Amina
댓글 수: 0
채택된 답변
Fangjun Jiang
2011년 8월 24일
What do you mean your program is in progress? If you want to keep a history of the commands executed in Command Window, use the diary() function.
Otherwise, the M-script or M-function you are running is the text file you want, right?
댓글 수: 5
Fangjun Jiang
2011년 8월 24일
You need to specify fid for the fprintf(), and also provide a number.
fprintf(fid,'Hello %g.\n',1234)
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Data Import and Export에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!