MATLAB: How to average multiple matrices by element to create a new matrix of the same size

averageby elementmatrix

I have 31 matrices, each of size 72×144, and each representing a day of the month of January. I would like to have a 32nd matrix, also of size 72×144, 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]
I want:
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.
Thanks, Patrick

Best Answer

meanMatrix = (matrix1 + matrix2 + matrix3 + .... etc...... + matrix 30 + matrix31)/31;