adding data to a text file
이전 댓글 표시
i have a file called hello.txt using wordpad which contains the matrix
2 7 3
2 6 9
now i have a vector v = [1 2 3] and i want to add this vector to the hello.txt file so when i open the hello.txt file i should have
2 7 3
2 6 9
1 2 3
how can i do this
댓글 수: 1
Walter Roberson
2012년 3월 15일
Duplicate is at http://www.mathworks.com/matlabcentral/answers/32377-appending-a-file
채택된 답변
추가 답변 (1개)
Geoff
2012년 3월 15일
1 개 추천
I remember answering an almost identical question from you the other day. It used the fopen() with the open-mode 'w' to overwrite.
To append, use the open-mode 'a'.
댓글 수: 2
lowcalorie
2012년 3월 15일
Walter Roberson
2012년 3월 15일
"lowcalorie" is using WordPad to examine the file. "at" is needed instead of just "a", as WordPad is an old editor that only understands lines if they end in the combination CARRIAGE-RETURN LINEFEED which you do not get if you use only "a" permissions when you are using MS Windows.
카테고리
도움말 센터 및 File Exchange에서 Convert Image Type에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!