How to place multiple csv files along coloum, side by side, in a single file.
古いコメントを表示
Hi I want to place all csv files, under a folder, into a single sheet as single csv file alone coloum direction, side by side.
For example, first file- col A to C, second file- col D to F, and so on, according to file hierarchy (order) of the input folder. I Have studied some existing tutorial in mathwork but still can not solve my problem. All files have equal col and row dimension. I have attached 2 sample file here out of 4000 files. Note that all csv files have single sheet only.
Thanks in advance for solution.
2 件のコメント
per isakson
2015 年 12 月 18 日
Do you want a csv-file with 4000x3 columns?
hosse
2015 年 12 月 18 日
採用された回答
その他の回答 (1 件)
Ingrid
2015 年 12 月 18 日
this can be easily achieved with the following code
listing = dir(nameFolder);
N = numel(listing);
data = [];
for ii = 3:N
fid = fopen(listing{ii}));
newData = textscan(fid,'%f%f%f);
data = [data, newData];
fclose(fid);
end
1 件のコメント
Guillaume
2015 年 12 月 18 日
I'd qualify that easily. Doing 4000 reallocations of data due to the resizing on each file, to end up with 4.3 GB matrix is going to take a long time.
カテゴリ
ヘルプ センター および File Exchange で Text Data Preparation についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!