It should be d = [15 18;21 24] because a,b and c all are of 2*2 order.
my question is if a=[1 2;3 4],b=[5 6;7 8],c=[9 10;11 12] the resultant matrix should be d=[1 5 9;2 6 10;3 7 11;4 8 12] this should be done using for loop?
4 views (last 30 days)
Show older comments
my question is if a=[1 2;3 4],b=[5 6;7 8],c=[9 10;11 12]
the resultant matrix should be d=[1 5 9;2 6 10;3 7 11;4 8 12] this should be done using for loop?
2 Comments
DGM
on 13 Jan 2025
Nobody suggested that the goal was to take the sum. The given result for d is clearly done by reshaping the contents of a, b, and c as is shown in the other comments.
a = [1 2;3 4];
b = [5 6;7 8];
c = [9 10;11 12];
d = reshape([a; b; c].',[],3)
Accepted Answer
More Answers (0)
See Also
Categories
Find more on Linear Algebra in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!