How to append data or values to an existing .csv file??

조회 수: 1 (최근 30일)
Manoj Murali
Manoj Murali 2012년 2월 10일
hi..suppose i have a .csv file named csvfile.csv.And it has the values as follows:
23 45
69 84
48 78
12 34
so it has two colums.Now wat i need to do is to add values staring from the 3rd colum with out deleting the values in the 1st and 2nd colums..How can i do this...??Any one plz help..!!

답변 (1개)

Andreas
Andreas 2012년 2월 14일
Hi,
try to read your .csv file (which is actually NOT a Comma Separated Values file) with
OldData = dlmread('csvfile.csv', ' '); (BLANK as delimiter)
Assuming your new data is NewData = [1 2 3 4], you can save/overwrite the file with
dlmwrite('csvfile.csv',[OldData NewData'], ' ');
Regards, Andreas

카테고리

Help CenterFile Exchange에서 Data Import and Analysis에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by