MATLAB Answers

0

How to add data to an existing txt file which already contains some lines ?

Asked by bh dhouha on 6 Aug 2015
Latest activity Commented on by Marisabel Gonzalez on 5 Apr 2019
How to add data to an existing txt file which already contains some lines ?

  0 Comments

Sign in to comment.

Tags

2 Answers

Answer by Azzi Abdelmalek
on 6 Aug 2015
 Accepted Answer

a=[1 2 3;4 5 6]
dlmwrite('file.txt',a,'-append','newline','pc')

  1 Comment

Sign in to comment.


Answer by Stephen Cobeldick on 6 Aug 2015
Edited by Stephen Cobeldick on 6 Aug 2015

Read the fopen documentation and have a look at the permission options. You will find the permission 'a' or 'a+' of particular interest.
You can use fprintf to print text to file, or one of the other text-file writing functions.

  0 Comments

Sign in to comment.