Replicate matrix elements without for loop
2 views (last 30 days)
Show older comments
Howard Wilton
on 22 Nov 2022
Commented: Howard Wilton
on 22 Nov 2022
I am trying to take the matrix
base =[1 2; 3 4]
and replicate the elements to give
expn = [ 1 1 2 2; 1 1 2 2; 3 3 4 4; 3 3 4 4]
without using for loops. I would like to use repmat but not sure how to do that elementwise.
Accepted Answer
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!