For loop to split matrix to equal sized sub-matrices
问题 Given a square matrix of say size 400x400 , how would I go about splitting this into constituent sub-matrices of 20x20 using a for-loop? I can\'t even think where to begin! I imagine I want something like : [x,y] = size(matrix) for i = 1:20:x for j = 1:20:y but I\'m unsure how I would proceed. Thoughts? 回答1: Well, I know that the poster explicitly asked for a for loop, and Jeff Mather's answer provided exactly that. But still I got curious whether it is possible to decompose a matrix into