Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Average of multiple matrices

12 views
Skip to first unread message

fmri

unread,
Apr 6, 2016, 7:25:09 AM4/6/16
to
Hi all,

I have different matrices each contain 6 vectors : e,g,

>>S1
1 1 1 1 1 1
2 2 2 2 2 2
2 3 2 3 2 3

>>S2
1 2 1 1 1 1
2 2 3 2 2 2
2 5 2 3 2 6
.
.
.
>>S15
1 2 1 1 1 1
2 2 3 2 2 2
2 5 2 8 2 7

I would like to calculate the mean of each corresponding column :

I tried this

for i=1:15 mean (S(i)(:,1))
end

It does not work.

I tried then to convert the matrices (they are double) to cells but still I was cannot calculate the means.


Any help will be appreciated

Aser

dpb

unread,
Apr 6, 2016, 9:04:10 AM4/6/16
to
On 04/06/2016 6:25 AM, fmri wrote:
> Hi all,
> I have different matrices each contain 6 vectors : e,g,
>>> S1
> 1 1 1 1 1 1 2 2 2 2 2 2 2 3 2 3 2 3
>
>>> S2
> 1 2 1 1 1 1 2 2 3 2 2 2 2 5 2 3 2 6
> .
> .
> .
>>> S15
> 1 2 1 1 1 1 2 2 3 2 2 2 2 5 2 8 2 7
>
> I would like to calculate the mean of each corresponding column :
>
...

mean([S1;S2;S15])

BUT!! Don't create multiple variable with numeric postfixes and you
wouldn't have the referencing issues; use arrays or name fields in
structures or similar techniques instead.

--

0 new messages