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.

## Best Answer