I have a matrix which is a 372x6. Rather than find a mean for a specific row or a specific column, I want to find the mean of elements that lay in different rows as
Although the elements are from different rows, I have a pattern for the order in which they are to be taken. The last 2 elements (column 5 and 6) is to be averaged with the second third and fourth of the following row. The mean then needs to be found for each line. To make this easier to visualise I have written out a matrix for which we need to find 2 means. We need one mean to be of (e f h i j) and the other (k l m n o). For my case however I need to do this 371 times as we have 372 lines (obviously we can’t find mean for the first row).
(a b c d e f)
(g h i j k l)
(l m n o p q)