add an empty line in the text file

조회 수: 8 (최근 30일)
Ahsan Khan
Ahsan Khan 2011년 10월 26일
hi there, I'm writing this program where the results are writtten to a text file. i am using: dlmwrite('test.txt',mat, '-append','delimiter','\t','newline','pc')
text file looks like:
2
3
4
6
but i want to add an empty line in between each results. looking like:
2
3
4
6
how do i do that?...please help. thanks in advance.
cheers SN

채택된 답변

Fangjun Jiang
Fangjun Jiang 2011년 10월 26일
use fprintf()
fid=fopen('test.txt','wt');
fprintf(fid,'%d\n\n',mat);
fclose(fid)
  댓글 수: 1
Walter Roberson
Walter Roberson 2011년 10월 26일
It isn't clear to me whether the poster has one item per line or if that was merely a simplified example.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Environment and Settings에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by