Combine columns from different matrix
1 次查看(过去 30 天)
显示 更早的评论
Hello everyone : I need to combine three arrays
A=[2 4 5; B=[4 6 3; C=[5 2 5;
4 6 8; 2 4 6; 2 4 5;
1 4 7;]; 0 4 5;]; 1 3 5;];
to
output[ 2 4 5 4 6 2 5 3 5;
4 2 2 6 4 4 8 6 5;
1 0 1 4 4 3 7 5 5;]
output[column1 from A , column1 from B , Column1 form C,column2 from A, Column2 from B, colomn2 from c,column 3 from A, ........];
0 个评论
采纳的回答
Star Strider
2015-11-11
A loop is one option:
A=[2 4 5;
4 6 8;
1 4 7;];
B=[4 6 3;
2 4 6;
0 4 5;];
C=[5 2 5;
2 4 5;
1 3 5;];
output = [];
for k1 = 1:3
output = [output A(:,k1) B(:,k1) C(:,k1)];
end
output =
2 4 5 4 6 2 5 3 5
4 2 2 6 4 4 8 6 5
1 0 1 4 4 3 7 5 5
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Logical 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!