[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: AGAIN A SIMPLY QUESTION
From: |
James Sherman Jr. |
Subject: |
Re: AGAIN A SIMPLY QUESTION |
Date: |
Tue, 11 Sep 2007 13:39:27 -0400 |
You could always do some simple multiplication:
B = ones(3, 1) * A;
I can't think of a faster way, since writing a for loop to replace
each row individually is bound to be slower.
James
On 9/11/07, Oscar Bayona Candel <address@hidden> wrote:
>
>
> Hi,
>
> There is any function that if I want to replace a row vector in all rows of
> a matrix could do it?
>
> In example:
>
> A=[ 2.5 3.6 2 3 9] %this is an 1x5 vector
>
> B=[1 1 1 1 1
> 1 1 1 1 1
> 1 1 1 1 1] % B is an 3x5 matrix
>
> I number of colums of A and B always coincide how can I replace all rows of
> B for A so that
>
> I obteine this result?
>
> (this should be the result)
>
> B=[2.5 3.6 2 3 9
> 2.5 3.6 2 3 9
> 2.5 3.6 2 3 9]
>
>
> As always, thanks in advance, and best regards. Sorry again if I express
> incorrectly.
>
>
> ________________________________
> Llama a tus amigos de PC a PC: ¡Es GRATIS! Pruébalo
> _______________________________________________
> Help-octave mailing list
> address@hidden
> https://www.cae.wisc.edu/mailman/listinfo/help-octave
>
>