How to save results into csv file

1 回表示 (過去 30 日間)
Nivodi
Nivodi 2018 年 7 月 22 日
コメント済み: Nivodi 2018 年 7 月 23 日
Hello everyone, I have a csv file (9X15). At the 15th column, I have times and I converted them in seconds. How can I add/save these results (from the command window)into a new column (16th) at the same csv file.? Thank you very much

採用された回答

Image Analyst
Image Analyst 2018 年 7 月 22 日
Stitch the column onto the right side, and then call csvwrite():
m16Cols = [m15Cols, column16]; % Stitch column16 onto existing 15 column matrix.
csvwrite(filename, m16Cols);
  3 件のコメント
Image Analyst
Image Analyst 2018 年 7 月 22 日
You didn't say they were tables before. Try using join() or outerjoin(), but it should work as is. Then use writetable() instead of csvwrite().
What are the data types of m15Cols and column16? They should both be tables. Evidently one of them is NOT a table - it's probably a regular double vector or something. Here is a demo:
load patients % Load built-in demo data.
T4 = table(Age,Height,Weight,Systolic, ...
'RowNames',LastName)
T1 = table(Diastolic)
Tboth = [T4, T1]
writetable(Tboth, filename);
Nivodi
Nivodi 2018 年 7 月 23 日
Thank you very much for your help!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeStructures についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by