Writing Multiple CSV files
古いコメントを表示
I have a dataset which has about 20 spectra. All 20 spectra share the same x-axis. So I have 21 columns, column 1 representing the x-axis and columns 2 to 21 representing the y values. I want to save the data 20 separate .csv files. Csvwrite just combines all the data into one large csv files which is not what I want. I want a code that can save cloumn 1 and 2 separately, 1 and 3 separately, 1 and 4 separately and so on till column 1 and 21 so that in the end I will have 20 separate csv files each having column 1 as the x-axis and the corresponding y column as y-axis.
Look forward to hearing from someone and I would really appreciate it.
Thanks.
5 件のコメント
per isakson
2017 年 11 月 10 日
編集済み: per isakson
2017 年 11 月 10 日
Something like this?
for jj = 2:21
csvwrite( sprintf( 'y%d.csv', jj ), M(:,[1,jj]) );
end
KSSV
2017 年 11 月 10 日
IT is better to have all the data in single csv files.
Curious Mind
2017 年 11 月 10 日
Curious Mind
2017 年 11 月 10 日
per isakson
2017 年 11 月 10 日
編集済み: per isakson
2017 年 11 月 10 日
- M is your dataset with 21 columns
- sprintf( 'y%d.csv', jj ) creates a filename
採用された回答
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Text Files についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!