Possible Duplicate:
Element-wise array replication in Matlab
I have a m x 1
vector that I would like to repeat n
times to create a (m*n)x1
vector. If I use repmat
, I get something like
>> V = [a;b;c];
>> repmat(V,2,1) % n = 2, m = 3
a
b
c
a
b
c
What would be a one-line (and hopefully fast) way of getting the vector
[a;a;a;b;b;b;c;c;c]
for arbitrary n
and m
?