concatenate data files horizontally into one file

1 次查看(过去 30 天)
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 个评论
Walter Roberson
Walter Roberson 2012-1-24
duplicate is at http://www.mathworks.com/matlabcentral/answers/26882-concatenate-data-files-horizontally-into-one-file

请先登录,再进行评论。

回答(1 个)

Thomas
Thomas 2012-1-24
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];

类别

Help CenterFile Exchange 中查找有关 File Operations 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by