write in a specific line of text file
조회 수: 15 (최근 30일)
이전 댓글 표시
Hi all,
I'm writing a code and I would save the result in a specific line of text file. for example, the code should write the result on .txt file from line 6 or 7 but I don't know how can I do it. I've used
fid = fopen('z.txt', 'w');
fprintf(fid, '%d\r\n',MyResult);
fclose(fid)
But it can just write in a new line no each line as I want. Could you please help me
Hamed
댓글 수: 4
Rik
2018년 1월 24일
If you want to append lines, read the doc. If you want to do something else, you'll have to explain it more, preferably with some examples, because right now, I don't know if I understand you.
답변 (1개)
Rik
2018년 1월 24일
Use the append switch in fopen, fprinft an empty line, and fprintf the matrix with the FormatSpec of your choosing.
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Low-Level File I/O에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!