From: Shaddy on
How can I create a matrix from a repeated vector.
For example, I have
a=[ 1 2 3 4 5 6 7 ];
How can I create the following matrix
A=[1 2 3 4 5 6 7
1 2 3 4 5 6 7
1 2 3 4 5 6 7
1 2 3 4 5 6 7
1 2 3 4 5 6 7
1 2 3 4 5 6 7 ];

I can use a for loop, but I am wondering if there is a better way to do so.

Thanks
From: Andy on
"Shaddy " <shaddyab(a)gmail.com> wrote in message <i1poca$6c3$1(a)fred.mathworks.com>...
> How can I create a matrix from a repeated vector.
> For example, I have
> a=[ 1 2 3 4 5 6 7 ];
> How can I create the following matrix
> A=[1 2 3 4 5 6 7
> 1 2 3 4 5 6 7
> 1 2 3 4 5 6 7
> 1 2 3 4 5 6 7
> 1 2 3 4 5 6 7
> 1 2 3 4 5 6 7 ];
>
> I can use a for loop, but I am wondering if there is a better way to do so.
>
> Thanks

help repmat
From: Shaddy on
"Andy " <myfakeemailaddress(a)gmail.com> wrote in message <i1pp28$k47$1(a)fred.mathworks.com>...
> "Shaddy " <shaddyab(a)gmail.com> wrote in message <i1poca$6c3$1(a)fred.mathworks.com>...
> > How can I create a matrix from a repeated vector.
> > For example, I have
> > a=[ 1 2 3 4 5 6 7 ];
> > How can I create the following matrix
> > A=[1 2 3 4 5 6 7
> > 1 2 3 4 5 6 7
> > 1 2 3 4 5 6 7
> > 1 2 3 4 5 6 7
> > 1 2 3 4 5 6 7
> > 1 2 3 4 5 6 7 ];
> >
> > I can use a for loop, but I am wondering if there is a better way to do so.
> >
> > Thanks
>
> help repmat

I already tried to use repmat but it did not give me what I am need. Probably because it will Replicate and tile.

How should I use repmat in this case ?

Thanks
From: Walter Roberson on
Shaddy wrote:
> "Andy " <myfakeemailaddress(a)gmail.com> wrote in message
> <i1pp28$k47$1(a)fred.mathworks.com>...
>> "Shaddy " <shaddyab(a)gmail.com> wrote in message
>> <i1poca$6c3$1(a)fred.mathworks.com>...
>> > How can I create a matrix from a repeated vector.
>> > For example, I have
>> > a=[ 1 2 3 4 5 6 7 ];
>> > How can I create the following matrix
>> > A=[1 2 3 4 5 6 7 > 1 2 3 4 5 6 7 > 1 2 3 4 5 6 7 > 1
>> 2 3 4 5 6 7 > 1 2 3 4 5 6 7 > 1 2 3 4 5 6 7 ];
>> > > I can use a for loop, but I am wondering if there is a better way
>> to do so.
>> > > Thanks
>>
>> help repmat
>
> I already tried to use repmat but it did not give me what I am need.
> Probably because it will Replicate and tile.
>
> How should I use repmat in this case ?

repmat(a,floor(exp(pi)),1)
From: us on
"Shaddy " <shaddyab(a)gmail.com> wrote in message <i1v82r$gl3$1(a)fred.mathworks.com>...
> "Andy " <myfakeemailaddress(a)gmail.com> wrote in message <i1pp28$k47$1(a)fred.mathworks.com>...
> > "Shaddy " <shaddyab(a)gmail.com> wrote in message <i1poca$6c3$1(a)fred.mathworks.com>...
> > > How can I create a matrix from a repeated vector.
> > > For example, I have
> > > a=[ 1 2 3 4 5 6 7 ];
> > > How can I create the following matrix
> > > A=[1 2 3 4 5 6 7
> > > 1 2 3 4 5 6 7
> > > 1 2 3 4 5 6 7
> > > 1 2 3 4 5 6 7
> > > 1 2 3 4 5 6 7
> > > 1 2 3 4 5 6 7 ];
> > >
> > > I can use a for loop, but I am wondering if there is a better way to do so.
> > >
> > > Thanks
> >
> > help repmat
>
> I already tried to use repmat but it did not give me what I am need. Probably because it will Replicate and tile.
>
> How should I use repmat in this case ?
>
> Thanks

a hint:
- read, again:

help repmat;

us