Prev: MATLAB crop something in a figure, how to resolve it?
Next: plot3 : colour proportional to height?
From: Shaddy on 16 Jul 2010 09:55 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 16 Jul 2010 10:07 "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 18 Jul 2010 11:54 "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 18 Jul 2010 19:45 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 19 Jul 2010 00:41 "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
|
Pages: 1 Prev: MATLAB crop something in a figure, how to resolve it? Next: plot3 : colour proportional to height? |