MATLAB: Sum up parts of a vector

cumsumsumvector

Dear all,
I have a 105120*1 vector and I want to sum up in steps of 288. So I want to have the sum of the first 288 elements, then the sum of the next 288 elements and so, until the end of the vector. So finally I want to have a new vector of the dimension 365*1. So I need finally 365 sums. How can I do that?

Best Answer

x=rand(105120,1);
out=sum(reshape(x,288,[]))'