MATLAB: Cumsum reset back to zero every 100 times

cumsumplot cumsumreset to zero

I have a matrix R = [1×601] size. I want to use cumsum to get an accumulative value but reset cumsum back to zero each 100 positions.
Then I want to plot the result, so there should be 6 times where the plot goes back to zero on the y axis.
Is this possible? Please let me know if you don't understand what I'm trying to achieve, and thanks!! Have a good day, Chris

Best Answer

I interpreted "reset cumsum to zero" as restart cumsum from scratch.
data = rand(1,601);
dummy = zeros(100,ceil(size(data,2)./100));
dummy(1:numel(data)) = data;
dummy = cumsum(dummy,1);
plot(data); hold on
data = dummy(1:numel(data));
plot(data);