How do I insert one array into another?
4 views (last 30 days)
Show older comments
I have two arrays with elements of type double. I want to insert the 1st column of array 2 after the 1st column of array 1, the 2nd column of array 2 after the 2nd column of array 1, and so on. How do I do this?
0 Comments
Accepted Answer
Chunru
on 25 Aug 2022
a = reshape(1:12, 3, 4)
b = reshape(13:24, 3, 4)
% You stack a and b, then reshape it
a = reshape([a; b], 3, 8)
0 Comments
More Answers (0)
See Also
Categories
Find more on Matrix Indexing 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!