How can I average values from 3 consecutive rows of a matrix in one designated column repeatedly over the whole matrix?
Mostra commenti meno recenti
This is what an example of the original matrix A looks like.
A = 6x6
1 3 4 3 4 5
2 4 5 7 7 4
7 9 5 6 4 3
4 9 4 5 3 2
9 3 2 2 1 1
4 5 6 1 1 2
Now i would like to create a column array with two values. The first value woul be the average of A(1,2),A(2,2),A(3,2) and the second value would be when you calculate the average of A(4,2),A(5,2),A(6,2).
This would then form the column array B
B = 2x1
5.33
5.66
Now comes the important part. My matrix has over 200'000 rows and i want to do this repeatedly over all rows of the matrix in one column. Always calculate the mean value of the numbers at the same column position in 3 consecutive rows and then take the mean of the next 3 and so on... And then create a new column array with all the mean values (the length of the new array would be a third of the original matrix). I don't know the absolute length of the matrix since it can vary due to different measurements so it should be some kind of loop that does not take forever to calculate since there are so many rows.
Thank you already for your time.
Risposta accettata
Più risposte (0)
Categorie
Scopri di più su Matrix Indexing in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!