How can I average multiple matrices by element to create a new matrix of the same size?
415 views (last 30 days)
I have 31 matrices, each of size 72x144, and each representing a day of the month of January. I would like to have a 32nd matrix, also of size 72x144, which includes the average value for each element in the original 31 matrices. For example, if I have:
A=[1,2,3|2,3,4|3,4,5] B=[2,3,4|3,4,5|4,5,6] C=[3,4,5|4,5,6|5,6,7]
D=[2,3,4|3,4,5|4,5,6] (the average by element of the originals)
What is the easiest way for me to do this? I have found a few threads here which have answers I don't really understand, as I am relatively unfamiliar with writing codes, for MATLAB or otherwise. I need something easy to understand.
More Answers (3)
Matt J on 2 Oct 2013
Read the matrices into the slices A(:,:,i) of a 3D array and do