dlmwrite -append problems when writing char and numbers to .txt file
Show older comments
I am having troubles trying to write a mix of char and numbers to a delimited file.
that dlmwrite cannot handle both char and num and must use a cell array and thus dlmwrite treats each char as a separate element and places a delimiter between each char and number.
basically what i am doing is reading in a large csv files with mix of char and numbers and sorting through the file line by line and only copying the lines that are for the same location (based on a unique id code) to a new file. the data is a mixed bag of temp for all the met stations in tanzania.
example line from my data: "TANZANIA,UNITED REPUBLIC OF",TZ03MSKR,,MUSEKERA,-9.3,33.6,12,1/1/1943,139
once found, i want to copy the exact line to a new file. most importantly i need to append each line to the existing file as my original file is for 35+ years of monthly readings for each 129 different stations.
i got everything working except the append part.
essentially its the same problem as this
filename = 'C:\test.txt';
str = 'test123';
dlmwrite(filename, str, '-append')
returns
t,e,s,t,1,2,3
i was wondering if anyone can help point out a workaround that is different from the quoted thread or is this the best method?
Thanx.
Accepted Answer
More Answers (0)
Categories
Find more on Text Files 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!