Info

この質問は閉じられています。 編集または回答するには再度開いてください。

Trying to write on .csv file, but every time I add something it cancels the previous stuff even if I put it in an empty space

1 回表示 (過去 30 日間)
EL
EL 2017 年 3 月 22 日
閉鎖済み: MATLAB Answer Bot 2021 年 8 月 20 日
I am doing a series of operations between elements of two columns. I would like to write the result on the same .csv file but when I do it it cancels all the data that was previously on the document. Moreover I am doing the operations through a for loop and writing the result through the same for statement, so at the end all I get is the result of the last operation and everything else is empty. This is what I have:
for x = 1:len
a1 = data(x, col1);
a2 = data(x,col2);
result = a1 + a2;
csvwrite('file.csv', result, x,19) %where 19 is the column I want the results to be in.
end
I am sure there must be a way, but can't seem to find it.
Thanks
  1 件のコメント
Stephen23
Stephen23 2017 年 3 月 22 日
"I am sure there must be a way"
Not using csvwrite, but you can write your own function using fopen, fprintf, and fclose.

回答 (0 件)

この質問は閉じられています。

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by