|
On Jan 19, 7:10=A0pm, "Sadik " <sadik.h...@gmail.com> wrote:
> perfr...@gmail.com wrote in message <d54e80af-5e1c-4601-9f1a-b7742ffb2...=
@g38g2000yqn.googlegroups.com>...
> > hello,
>
> > i am tryin to average together several columns of different matrices,
> > each column of slightly different sizes (difference might be one or
> > two elements).
> > for example, my columns a, b, c might be:
> > =A0 a =3D my_mat1(:, 2); # size 10
> > =A0 b =3D my_mat2(:, 2); # size 12
> > =A0 c =3D my_mat3(:, 2); # size 11
>
> > i want to make a new vector d that contains the averages of all their
> > values. the first 10 values can be averaged, then for the 11th i want
> > to have the average of b and c's values, and for the 12 value i only
> > want c's value.
>
> > is there an easy way to do this? a simple: a' + b' + c' ./ 3 does not
> > work because a b and c are all different sizes....
>
> > =A0 =A0 thank you.
>
> How about this one [I believe in the text you have written c instead of b=
, because in the code, it seems that it is b whose length is 12]:
>
> ([a;0;0]+b+[c;0])./[3*ones(length(a),1);2;1]
hi sadik,
thanks for your reply.
i am talking about the general case here though, the a, b, c was just
an example. i want to do this for n-many different vectors of all
potentially slightly different sizes...
|