Sum every nth row or array

115 views (last 30 days)
Terence Ryan
Terence Ryan on 30 Jan 2012
Answered: Aubai on 20 Jan 2017
Hello all,
I have an array which is 150x8192 elements. I want to sum every 4th row of this array, making the new array (150/4)x8192. I am running into issue determining the correct code. I have tried some simple nested for loops, but I always seem to get a new array with the same dimensions (150x8192). Thanks for any suggestions!

Answers (2)

Andreas Goser
Andreas Goser on 30 Jan 2012
If this is your matrix
Then this is "every 4th row"
I am not 100% sure what you meand about "sum every 4th row" and still you have the same number of columns, but something like
may be what you need.

Aubai on 20 Jan 2017

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by