Octave / Matlab: Extend a vector making it repeat itself?

Posted by Tom on Stack Overflow See other posts from Stack Overflow or by Tom
Published on 2010-03-17T04:08:41Z Indexed on 2010/03/17 4:11 UTC
Read the original article Hit count: 257

Filed under:
|
|

Hi everyone,

Is there a way to extend a vector by making it repeat itself?

>v = [1 2];
>v10 = v x 5; %x represents some function. Something like "1 2" x 5 in perl

Then v10 would be:

>v10
     1 2 1 2 1 2 1 2 1 2

This should work for the general case, not just for [1 2]

Thanks in advance !

© Stack Overflow or respective owner

Related posts about octave

Related posts about matlab