merging the matrices
5 views (last 30 days)
Show older comments
i have two matrices
A=[1 5 10
10 20 30
2 5 6]
B=[ 25 1 2
2 5 9
1 0 5]
i want to merge these two matrices such that i need output as
C=[1 5 10
25 1 2
10 20 30
2 5 9
2 5 6
1 0 5]
please help
0 Comments
Accepted Answer
Daniel Shub
on 20 Mar 2012
reshape([A B]', 3, 6)'
ans =
1 5 10
25 1 2
10 20 30
2 5 9
2 5 6
1 0 5
0 Comments
More Answers (2)
Jonathan Sullivan
on 20 Mar 2012
C = [A B];
C = reshape(C',[],3)'
2 Comments
Jonathan Sullivan
on 20 Mar 2012
I'm sorry. I mixed up the [] and the 3. It should read:
C = [A B];
C = reshape(C',3,[])'
See Also
Categories
Find more on Data Types 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!