MATLAB: To split a matrix into equal parts.

matrix manipulation

Hi, I am hanging with a problem regarding matrix splitting. I have a 128 by 128 matrix and want to split it into 16 equal matrices(i.e. having dim 32 by 32). Now, want to extract the middle element from each of these newly derived matrices(i.e from 32 by 32 one)to construct a new matrix having only 16 elements(i.e. 4 by 4 matrix).Since 32 by 32 is an even dim matrix so extraction from next to the middle one is required. Can anyone please help me out in doing this? Thanking you!

Best Answer

Hi,
why reshaping? When you know which elements you like, use linear indexing. This example pics up the elemtents (16,16), (48,16) and so on
a = rand(128);
a(16:32:128,16:32:128)
Related Question