Hello i have a matrix whose rows and columns are multiple of 8 let's say 256x160 and i need to have as output all the possible submatrix of 8x8 elements. Fore few elements i can write
bloc = 8;
imm = imread('cameraman.tif');
[rows, columns, dimension] = size(imm); % dimension if the image is RGB
nr = rows/bloc; % numeber of blocks of rows
nc = columns/bloc; % number of blocks of columns
cell_row = repmat(bloc,1,nr);
cell_columns = repmat(bloc,1,nc);
N = mat2cell(imm, [cell_row,[cell_columns]);
I think that now it works quite good but if there is a better way just tell me thanks