0

for example I have a vector

  x=[1 0 0];

I want to triple it

   x=[1 0 0 1 0 0 1 0 0]

I know this way

    new_x=[x,x,x];

but if I want to do it 200 times not 3 times I will not write x for 200 times in new vector. So I am asking you to give me an easier solution. Thanks !

Dan
  • 45,079
  • 17
  • 88
  • 157

1 Answers1

0

Use repmat:

new_x = repmat(x,1,3)
Volodymyr B.
  • 3,369
  • 2
  • 30
  • 48