MATLAB: How to sum some columns of an array


I have a 183×74 array that is number of cases per day that I need to make number of cases per week. I need to sum columns 1 through 7, 8 through 15, etc. but 74 is not evenly divisible by 7.

Best Answer

  • Even better, is to reshape
    m=sum(reshape(yourMatrix(:,1:70),1281,10));%m will be an array with the sums you desire