How to repeat a row by a certain factor
Show older comments
I have this sample matrix:
A=[2 2 2; 3 3 3; 4 4 4];
I would like to multiply each row by a certain factor (in this specific case, the first by 2, the second by 1, and the third by 3) to generate:
A_New= 2 2 2 2 2 2 3 3 3 4 4 4 4 4 4 4 4 4
Does anyone have suggestions on how to do this? I tried:
B = repmat(A,[2 1 3],1)
but this created separate matrices.
Accepted Answer
More Answers (1)
Jessica
on 26 Apr 2015
0 votes
Categories
Find more on Multirate Signal Processing 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!