MATLAB: For loop

for loop

this is my current code
mean(sum(abs(xw(:,:,3,10))-(xw(:,:,3,9))));
this can run and have value but this code could calculate tenth frame and ninth frame
but now, I must calculate the 100 frames that from fourth frame to 100th frames I know to use " for loop", but I can't write please tell me how to do

Best Answer

Let's say that "k" is your for loop index. Then just say:
mean(sum(double(xw(:,:,3, k)) - double(xw(:,:,3, k-1))));
to get the mean column-by-column difference in the blue channels of your video frames.