How to import many csv files in matlab and export one excel file?

14 ビュー (過去 30 日間)
정우 제
정우 제 2021 年 9 月 14 日
回答済み: Prince Kumar 2021 年 11 月 24 日
many cvs files 9, 10(or J, K) matrix read in matlab ->many variable calculate -> input one excel file
  1 件のコメント
源樹 上林
源樹 上林 2021 年 9 月 14 日
How about this way ?
a = xlsread('hogehoge.csv');
b = xlsread('fugafuga.csv');
filename = 'piyopiyo.xlsx';
xlswrite(filename, a, 'sheet1');
xlswrite(filename, b, 'sheet2');

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

回答 (1 件)

Prince Kumar
Prince Kumar 2021 年 11 月 24 日
Hi,
You can use readtable function to read the csv files and combine them into a single excel file.
t1 = readtable('data1.csv');
t2 = readtable('data2.csv');
writetable(t1,'myData.xls','Sheet',1);
writetable(t2,'myData.xls','Sheet',2);
Here, content of 'data1.csv' and 'data2.csv' is being writtent to sheet 1 and 2 of the excel sheet respectively.

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by