MATLAB: Step loop forward 10 units of a vector every iteration

breaking vector into chunksiterationsloops

* UPDATE: To help clarify, I'm zooming out on my original problem. I have a long timeseries (OCS_d41) of 1/Hz data along a time vector (doyall) for which I would like to get hourly averages over 10-day intervals. I would then like to step forward to the next ten days along doyall and do the same thing, until the end of the timeseries. *
Within a loop, I need to break a vector (doyall, which begins at 138), into units of 10 through the length of the vector and apply a transformation (consolidator is the name of the plug-in script), and then save it out as a newly named vector.
The first iteration should cover 138: < 148. The second iteration should cover 148: < 158. The third iteration should cover 158: < 168, etc.
I don't know how to phrase the code so that it's applying the transformation within the loop only to chunks of 10 units of the vector at a time, then stepping forward to the next 10 units of the vector. Here is the code I have so far:
for doyall=138:(138+9):length(doyall);
itcount=itcount+1;
[hourallC, strcat('OCS_d41C_',num2str(itcount,'%02i'))]=consolidator(hourall, OCS_d41, 'nanmean', 0);
end
Thanks everybody. I appreciate it.

Best Answer

doyall=138:10:length(doyall);