dlmwrite a matrix into an existing csv file
Show older comments
Dear All,
I do have a a csv file which is basically a 5*6 matrix like the following one:
test.cvs = [1 2 3 4 5 6
2 3 4 5 6 7
3 4 5 6 7 8
4 5 6 7 8 9
5 6 7 8 8 8]
Then, I want to dlmwrite the matrix q and at the same time append the data that had been already existed in the csv file. However, I do not want to add matrix q as the 7th row! I like to dlmwrite matrix q in the following way:
q = [11 12 12 12 13]
test.csv = [1 2 3 4 5 6 11 12 12 12 13
2 3 4 5 6 7 0 0 0 0 0
3 4 5 6 7 8 0 0 0 0 0
4 5 6 7 8 9 0 0 0 0 0
5 6 7 8 8 8 0 0 0 0 0 ]
I know that we can use the below command to append by column but I wonder if there is way to append in the way I want it?
dlmwrite('test.csv', q, 'delimiter', ',', 'precision', 9 ,'-append')
Thanks.
Accepted Answer
More Answers (0)
Categories
Find more on Spreadsheets in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!