八度/ Matlab:扩展一个向量,使其重复自己?
有没有办法通过重复自己来扩展向量?
>v = [1 2]; >v10 = vx 5; %x represents some function. Something like "1 2" x 5 in perl 那么v10将是:
 >v10 1 2 1 2 1 2 1 2 1 2 
这应该适用于一般情况,而不仅仅是[1 2]
 你正在寻找的function是repmat() 。 
 v10 = repmat(v, 1, 5) 
很明显,如果你知道在哪个方向扩展vector,repmat就是要走的路。
然而,如果你想要一个总是在最长的方向上重复向量的解决scheme,这个repmat和索引的组合应该可以做到这一点:
  v10=v(repmat(1:length(v),1,5))