MATLAB: To split a matrix into equal parts.

matrix manipulation

Hi, Thanks to your answers, but did not get it properly. I am making it simpler by considering for a 6 by 6 matrix.Suppose I have a 6 by 6 matrix where the elements vary from 1:36 in increment of 1. When I split it into 4 equal matrix the matrices should be:a(say)=[1 2 3; 7 8 9; 13 14 15],b(say)=[4 5 6;10 11 12; 16 17 18],c=[19 20 21;25 26 27; 31 32 33],d=[22 23 24;28 29 30; 34 35 36].Now, when I choose the middle element to construct a new matrix it should be M(say)=[8 11; 26 29]. Now, my question lies simply to generalize it for a 128 by 128 matrix. Thankin you!

Best Answer

Hi,
still the same answer as before:
a = reshape(1:36,6,6)
b = a(2:3:end,2:3:end)'
So when usingg 128x128 matrix:
a = reshape(1:128*128,128,128);
b = a(16:32:end,16:32:end)'