1

I need to double the size of my vector like this:

x=[1 1 0 1 0 0 1]

to

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

Is there a simple way to do this without a loop?

herohuyongtao
  • 49,413
  • 29
  • 133
  • 174
dreed75
  • 115
  • 1
  • 9

1 Answers1

4

This can be done by:

x=[1 1 0 1 0 0 1];
y=[x;x];
x = y(:)';
herohuyongtao
  • 49,413
  • 29
  • 133
  • 174