how to combine multiple files contain one column only into one file only

3 ビュー (過去 30 日間)
Shaziera Zaharri
Shaziera Zaharri 2019 年 3 月 15 日
編集済み: madhan ravi 2019 年 3 月 15 日
i have about 179 csv files contain a data in one column only. Then i need to combine all 179 files into 1 file contain one column also. Can anybody help me

回答 (2 件)

KSSV
KSSV 2019 年 3 月 15 日
files = dir('*.csv') ;
N = length(files) ;
A = cell(N,1) ;
for i = 1:N
data = csvread(files(i).name ;
A{i} = data ;
end
A = cell2mat(A) ;

madhan ravi
madhan ravi 2019 年 3 月 15 日
編集済み: madhan ravi 2019 年 3 月 15 日
numoffiles = 179;
C = cell(1, numoffiles);
for k = 1:numoffiles
myfilename = sprintf('file%d.csv', k); % filename
C{k} = reshape(dlmread(myfilename),[],1);
end
dlmwrite('Final.csv',vertcat(C{:}))

カテゴリ

Help Center および File ExchangeDirection of Arrival Estimation についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by