From: kk KKsingh on 9 Aug 2010 06:25 This sounds stupid may be its a long hour work which make my mind stop working ! But what is easiest way to create a copies of a vector in a matrix form ! My vector is t=[1 2 3 4 5 6] now i want t to be matrix of size ( 6 by 300) ..which means copies of my vector t in a matrix form ! Thanks
From: us on 9 Aug 2010 06:40 "kk KKsingh" <akikumar1983(a)gmail.com> wrote in message <i3ol26$rk4$1(a)fred.mathworks.com>... > This sounds stupid may be its a long hour work which make my mind stop working ! But what is easiest way to create a copies of a vector in a matrix form ! > > My vector is t=[1 2 3 4 5 6] > > now i want t to be matrix of size ( 6 by 300) ..which means copies of my vector t in a matrix form ! > > Thanks a hint: help repmat; % eg, v=1:3; r=repmat(v,4,1) %{ % r = 1 2 3 1 2 3 1 2 3 1 2 3 %} us
From: Jan Simon on 9 Aug 2010 08:22 Dear kk, > But what is easiest way to create a copies of a vector in a matrix form ! > My vector is t=[1 2 3 4 5 6] > now i want t to be matrix of size ( 6 by 300) ..which means copies of my vector t in a matrix form ! Beside REPMAT you could create the matrix manually also: t = 1:6; M = t(ones(1, 600), :); This is done in REPMAT also, so you could avoid the overhead. Please decide, which is "easiest" way. Kind regards, Jan
|
Pages: 1 Prev: Finding 3D Angle Next: Error while running COM automation server |