MATLAB: Creating new matrix from odd and even elements of an existing matrix.

even columnsMATLABmatrixodd rows

I need to construct a matrix consisting of elements that are in odd rows and even columns of an existing matrix(A). Matrix A is an 8×8 matrix. As of now, this is what I have:
OddRows = A(1:2:end,:)
EvenColumns = A(:,1:2:end)
That creats two separate matrices. One consists of the odd rows, and the other consists of the even columns. How can I combine the two of them into one matrix of shared values? Or is there an easyer way to construct this matrix straight from A?

Best Answer

I am not certain what result you want.
Try this:
A = randi(9, 5, 6)
OddRows = 1:2:size(A,1);
EvnCols = 2:2:size(A,2);
B = A(OddRows, EvnCols)