So you are after: [50, 25; 5, 10; 65,65] ?
[nRowsA, nColsA] = size(A);
ca = [1 3]; la = 1;
nRowsOut = nRowsA - length(la);
nColsOut = nColsA - length(ca);
Logical array same size as input
maskA = true(nRowsA, nColsA);
1 1 1 1
1 1 1 1
1 1 1 1
1 1 1 1
maskA(la,:) = false;
0 0 0 0
1 1 1 1
1 1 1 1
1 1 1 1
maskA(:,ca) = false;
0 0 0 0
0 1 0 1
0 1 0 1
0 1 0 1
trimmedA = A(maskA);
50
5
65
25
10
65
reshaped2array = reshape(trimmedA,nRowsOut, nColsOut);
50 25
5 10
65 65
The arrays you see are just output from the line above it and for some clarity in what is going on.
There probably is an easier way which no doubt someone will mention...
Best Answer