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
|
|
0
|
|
|
|
Reply
|
kk
|
8/9/2010 10:25:10 AM |
|
"kk KKsingh" <akikumar1983@gmail.com> wrote in message <i3ol26$rk4$1@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
|
|
1
|
|
|
|
Reply
|
us
|
8/9/2010 10:40:05 AM
|
|
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
|
|
0
|
|
|
|
Reply
|
Jan
|
8/9/2010 12:22:04 PM
|
|