I have 1000 csv.files with table format that I want to merge every 6 files together and turn them into another csv file of matrix.
I wrote this code It does not work. I will get error in the line 6"out = csvread(myFiles(m),1,0);"
Can you help me to make the idea to run?
cd 'path' % folther where the files are
myFiles = dir ('*.csv'); % all csv files
folder = cd;for m=1: numel(myFiles) out = csvread(myFiles(m),1,0); % read the first file
for n=m+1 : m+5 % loop over each 6 files
new = csvread(myFiles(n)},1,0); % Read the nth file
out = horzcat(out, new); % Concatenate the first file of the loop with others in rows
m=n endfile_name = sprintf('f%d.csv',m);csvwrite(file_name , out);end
Thanks in advance!
Best Answer