mean of 2 unequal matrices

Ben Abbott bpabbott at mac.com
Sun Jun 7 07:53:43 CDT 2009


On Jun 7, 2009, at 8:50 PM, "John W. Eaton" <jwe at octave.org> wrote:

> On  7-Jun-2009, Ben Abbott wrote:
>
> | On Jun 7, 2009, at 7:36 AM, Huub van Niekerk wrote:
> |
> | > Hi,
> | >
> | > I have 2 matrices: A: 200x1 and B: 300x1. I want to calculate the
> | > mean of the combined data but when I do mean_all = mean(A + B) I  
> get
> | > these mesages because the matrices aren't of the same dimensions.:
> | >
> | > >mean_all = mean(A + B);
> | > error: operator +: nonconformant arguments (op1 is 200x1, op2 is
> | > 300x1)
> | > error: evaluating binary operator `+' near line 12, column 28
> | > error: evaluating argument list element number 1
> | > error: evaluating assignment expression near line 12, column 10
> | >
> | > How can I accomplish this? By adding the means of A and B?
> | >
> |
> |
> | A + B is addition. You want a union.
> |
> | mean_all = mean (union (A, B));
>
> Won't union throw out duplicate values?  Maybe you want
>
>  mean  ([A; B])
>
> ?
>
> jwe

You are certainly correct! My bad!

Ben


More information about the Help-octave mailing list