MATLAB: How to combine multiple .dat files.

.datcombine filesdata processingexport filesimport files

I have 5 files (.dat) that are 2×20 (row,col) I want to import them and combine them in one file, the new file should (10×20)

Best Answer

Just call csvread or dlmread 5 times, then concatenate, then call csvwrite
m1 = csvread(filename1);
m2 = csvread(filename2);
m3 = csvread(filename3);
m4 = csvread(filename4);
m5 = csvread(filename5);
mOut = [m1;m2;m3;m4;m5];
csvwrite(fileNameOut, mOut);