From: Arie Driga on
I have two vectors:
A=(1x11)
and B is (1x2)

I would like to make a matrix (2x11)
the first row is each cell in A divided by B(1,1)
the second row us each cell in A divided by B(1,2)
From: Matt J on
bsxfun(@rdivide,A,B(:));
From: Arie Driga on
"James Tursa" <aclassyguy_with_a_k_not_a_c(a)hotmail.com> wrote in message <hrsnc8$17c$1(a)fred.mathworks.com>...
> "Arie Driga" <a_driga(a)yahoo.com> wrote in message <hrskq9$brb$1(a)fred.mathworks.com>...
> > I have two vectors:
> > A=(1x11)
> > and B is (1x2)
> >
> > I would like to make a matrix (2x11)
> > the first row is each cell in A divided by B(1,1)
> > the second row us each cell in A divided by B(1,2)
>
> bsxfun(@rdivide,A,reshape(B,[],1))
>
> James Tursa

I did it by B'*A=C

then I have 2x11 matrix, then I have another vector: D(1x2)
I want to multiply all the element of 1st row in matrix C with D(1,1) and the 2nd row with D(1,2)

How to do that?
From: Arie Driga on
"Arie Driga" <a_driga(a)yahoo.com> wrote in message <hrsot3$9ng$1(a)fred.mathworks.com>...
> "James Tursa" <aclassyguy_with_a_k_not_a_c(a)hotmail.com> wrote in message <hrsnc8$17c$1(a)fred.mathworks.com>...
> > "Arie Driga" <a_driga(a)yahoo.com> wrote in message <hrskq9$brb$1(a)fred.mathworks.com>...
> > > I have two vectors:
> > > A=(1x11)
> > > and B is (1x2)
> > >
> > > I would like to make a matrix (2x11)
> > > the first row is each cell in A divided by B(1,1)
> > > the second row us each cell in A divided by B(1,2)
> >
> > bsxfun(@rdivide,A,reshape(B,[],1))
> >
> > James Tursa
>
> I did it by B'*A=C
>
> then I have 2x11 matrix, then I have another vector: D(1x2)

> I want to multiply all the element of 1st row in matrix C with D(1,1) and the 2nd row with D(1,2)
>
> How to do that?

I found the answer:
E=bsxfun(@times,C,reshape(D,[],1))

thanks James for telling about the "bsxfun"

-case closed-