Average for each value from a set of matrices

I'm a rookie in this world and I have the following question.
How do I calculate from a set of matrices the mean for each value?
If I have 1[A, B, C], 2 [A, B, C], 3 [A, B, C] and finally obtain a new matrix X [A, B, C] with the means for A, B and C.
for i=1:length(files)
for j=1:length(files)
X(i,j)= mean(X(1:length(files)). name(i,j)
end
This expression do not work, Any idea??
Thank you in advance!

Answers (2)

a=[1 2 3];
b=[4 5 6];
c=[7 8 9]
d=[mean(a) mean(b) mean(c)]
If it's not what you are looking for, give an example

2 Comments

Jean commented
First, thank you so much for your quick Abdelmalek!
But exactly, what I pretend to do is a new matrix and with your example, the new matrix has the average for each value/box.
d=[4, 4.33, 6]
Thanks again!
Jan
Jan on 4 Aug 2013
Edited: Jan on 5 Aug 2013
@Jean: [4,4.33,6]?! Do you mean [4,5,6]?
Perhaps you are looking for something like this:
a = [1 2 3];
b = [4 5 6];
c = [7 8 9];
m = (a + b + c) / 3

This question is closed.

Asked:

on 4 Aug 2013

Closed:

on 20 Aug 2021

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!