MATLAB: Delete the center in an array

delete an array

Hi everybody,
I have an array, let's say 6×6, how to delete the center of this array. I mean I want to delete 3×3 center of this array.
simple example, if we have an array 6×6 with elements:
6 5 2 2 1 9
4 3 0 1 2 8
5 5 6 2 1 7
9 8 0 1 0 6
4 4 1 1 0 5
2 1 1 2 3 4
and I want to delete the center which are:
6 2
0 1
I hope you could help me, I've tried several time to solve it but I couldn't.
Thanks in advance.

Best Answer

‘I want to delete specific elements(3x3 or 2x2 whatever) inside a big array, and convert the rest of this array into a vector.’
That is straightforward:
A = [6 5 2 2 1 9
4 3 0 1 2 8
5 5 6 2 1 7
9 8 0 1 0 6
4 4 1 1 0 5
2 1 1 2 3 4];
Lidx = sub2ind(size(A), [3 3; 4 4], [3 3; 4 4]);
Center = A(Lidx) % View Elements
A(Lidx) = []; % Delete Elements, Return Vector