how to combine multiple files contain one column only into one file only
3 ビュー (過去 30 日間)
古いコメントを表示
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
0 件のコメント
回答 (2 件)
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) ;
0 件のコメント
madhan ravi
2019 年 3 月 15 日
編集済み: madhan ravi
2019 年 3 月 15 日
https://in.mathworks.com/help/matlab/import_export/process-a-sequence-of-files.html - good reference
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{:}))
0 件のコメント
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!