MATLAB: Combine multiple text files into one text file

data importsavetext file

Hi
I have multiple text files with names like 1.txt, 2.txt, 3.txt…… Each file has a single row of data(same format and length), I am think about combining those files into one text file which has a matrix data.
For example
1.txt has a row of " 1 3 4 8…."
2.txt has a row of " 3 5 7 3…."
3.txt has a row of " 9 1 3 5…."
……
I want to combine them into a file with a matrix like below,
1 3 4 8….
3 5 7 3….
9 1 3 5….
………..
………..
Thanks a lot

Best Answer

In DOS, I used to use this all the time.
copy 1.txt+2.txt+3.txt MyBigFat.txt
In MATLAB, you can use
system('copy 1.txt+2.txt+3.txt MyBigFat.txt')