So, I have a large matrix (rows = 1000; columns = 1000) and I have to compute the averages of each rows, but not the whole, only 100 columns, each step.
Let me explain:
There is a given matrix.
A = 1 2 3 4 5 67 8 9 10 11 1213 14 15 16 17 1819 20 21 22 23 2425 26 27 28 29 3031 32 33 34 35 36
In this case, I have to take the average of 2 columns (step by step) in each rows:
(1+2)/2 (3+4)/2 (5+6)/2(7+8)/2 (9+10)/2 (11+12)/2(13+14)/2 (15+16)/2 (17+18)/2 ...
The solution is a new matrix:
B = 1,5 3,5 5,57,5 9,5 11,513,5 15,5 17,519,5 21,5 23,525,5 27,5 29,531,5 33,5 35,5
How can I code this to make the same results in bigger sizes (to calculate the average in each row by columns 1-100; 101-200; 201-300; etc…)?
Any idea is highly welcomend!
Thank you!
Best Answer