I have few csv files, each has 3 columns with first two columns same in all. I want to merge all of them into a single csv file with first two common columns and continued with 3rd column of each individual files. Error associated is the same variable name for the 3rd column in all csv files. I'm attaching my code. Thanks in advance!
clcclear allclose allfiles = dir('*.csv');A = readtable(files(1).name);numfiles = length(files);for k=2:numfilesfilename = files(k).name;T = readtable(filename,"ReadVariableNames",true,"PreserveVariableNames",true); A = horzcat(A, T(:,3));endwritetable(A,'mergedCols.csv');
Best Answer