data appending in text file
조회 수: 5 (최근 30일)
이전 댓글 표시
Hi,
I created a text file using MATLAB. For example, 10 by 3 matrix and I saved it as a text using fopen and fprint in particular format. Now I want to append lines (data)to this text, say at row 1, row 5, and row 10, i.e at a fixed interval. How can I do this. Remember, I need to add lots of these lines.
I greatly appreciate any help.
Thanks Rafiq
댓글 수: 0
채택된 답변
추가 답변 (1개)
Walter Roberson
2013년 8월 14일
The only way to insert lines into a text file is to read in the file and write out the modified file. There is no way to seek directly to a particular line, and there is no way to insert in the middle of a text file.
Depending on what you want to insert into the file, you may wish to use system utilities such as "sed" or "awk" or "perl"
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Characters and Strings에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!