I have a 50x50 matrix, and I'd like to sum up the values in every 10x10 (or another set size value - always square) overlapping grid i.e.:
Overlapping windows are shown only in the diagonal for the sake of clarity. The first task I've tried to do is define the coordinates of each window:
win=10;
start = [1,10,1,10];
for y=1:(50-win)
for g=1:(50-win)
tmp = [start(g,1)+1,start(g,2)+1,start(end,3),start(end,4)];
start = [start;tmp];
end
start(end+1,1:4) = [1,10,1+y,10+y];
end
And then I'd loop over the list of coordinates, using sum and logical indexing for each window.
PROBLEM #1: The above code is not particularly eloquent. Can anybody show a more 'MATLABesque' way of doing it or a more concise way?
PROBLEM #2: I'd then like to define a particular coordinate (index) in the matrix e.g. m(26,26) and get a list of all windows this coordinate is contained within. But I have no idea how to do this. Can anybody show me how?
