MATLAB: Create a “moving window” plot

plotting

Hello, I have a cell array that i want to plot (all numeric values) called RR. the data was collected over time so values lower down would be later in time. i want to plot multiple plots on seperate figures in a moving window apporach.
I want to plot the first 257 points, and then the next 257 on a seperate plot etc and then the final plot which will be smaller than the rest
i know to use the first one I'd type:
plot(RR(1:257))
and then i'm assuming i should use a for loop but im struggling to incoporate it
Thank you in advance

Best Answer

Assuming numeric RR
for base = 1 : 257 : length(RR)
idx = base : min(length(RR), base+256);
figure
plot(idx, RR(idx));
end