I need to extract a 3x3 matrix from an image and store it separately, and it should continue like this till the end of image. For example, my image is the following matrix:
p = [ 1 2 3 4 5 6 7 8 9; ...
1 2 3 4 5 6 7 8 9; ...
1 2 3 4 5 6 7 8 9; ...
1 2 3 4 5 6 7 8 9; ...
1 2 3 4 5 6 7 8 9; ...
1 2 3 4 5 6 7 8 9 ]
The output should be like this:
p1 = [1 2 3; 1 2 3; 1 2 3]
p2 = [4 5 6; 4 5 6; 4 5 6]
p3 = [7 8 9; 7 8 9; 7 8 9]
and so on....
Can you please suggest me code or a built-in function for this?