How to insert new line text in a file?
조회 수: 2 (최근 30일)
이전 댓글 표시
fid1 = fopen('sample1.txt', 'a');
fprintf(fid1, '\n First line a b c d e f g h\n');
fclose(fid1);
fid2 = fopen('sample2.txt', 'a');
fprintf(fid2, '');
fprintf(fid2, '\nNew message in new line\n');
fclose(fid2);
Merge those two files into single file sample3.txt
I want to print those two lines one by one like below:
First line a b c d e f g h
New message in new line
Kindly do the needful
댓글 수: 2
Ameer Hamza
2020년 5월 23일
What is the error in your code? Also, there is no need to use two newlines.
답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 JSON Format에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!