MATLAB: Creating a submatrix from a matrix

matrix manipulationsubmatrix

I want a code to create a matrix which consist of rows and columns of another matrix.
i.e. A (4X4) = [ 1 2 3 4; 5 6 7 8; 1 3 5 7; 2 4 6 8; ]
The submatrix B consist of the { 1, 2, 4 }rows of A and the { 2,3 }columns of A:
Β (3Χ2) = [ 2 3; 6 7; 4 6; ]
Any help could be useful.
Thanks in advance!

Best Answer

A= [ 1 2 3 4; 5 6 7 8; 1 3 5 7; 2 4 6 8; ]
B=A([1 2 4],[2 3])