Change the lines to:
for i=1:8:size(luma,1)-7
for j=1:8:size(luma,2)-7
so that i and j never actually hit the very end of the array. The problem is that if i and j are at the very end, then i+7 and j+7 will be past the end. Setting them to 7 less means that the loop will end before so that i+7 and j+7 will not exceed the end.
1 Comment
Mark Whirdy (view profile)
Direct link to this comment
https://de.mathworks.com/matlabcentral/answers/56916-index-exceeds-matrix-dimention#comment_117917
Sign in to comment.