Clear Filters
Clear Filters

concatenate data files horizontally into one file

1 view (last 30 days)
Hello,
I have several data files with the same number of rows and I need to concatenate them all into one big file. For example, we might have the following two files:
XX_X1_XXX.dat:
1 1
2 2
3 3
XX_X2_XXX.dat
4 4 4
5 5 5
6 6 6
XX_X3_XXX.dat
7
8
9
and I want to concatenate data files into one horizontally into one file like below.
Bigdata.dat
1 1 4 4 4 7
2 2 5 5 5 8
3 3 6 6 6 9
Thanks a lot
  1 Comment
Walter Roberson
Walter Roberson on 24 Jan 2012
duplicate is at http://www.mathworks.com/matlabcentral/answers/26882-concatenate-data-files-horizontally-into-one-file

Sign in to comment.

Answers (1)

Thomas
Thomas on 24 Jan 2012
load XX_X1_XXX.dat; % this will put the values in Variable X1
load XX_X2_XXX.dat; % this will put the values in Variable X2
load XX_X3_XXX.dat; % this will put the values in Variable X3
bigdata=[X1 X2 X3];

Categories

Find more on File Operations in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!