MATLAB: Extracting rows based based on criteria from two columns

extracting rows based based on criteria from two columns

A= [1 1 4;
1 2 6;
1 3 9;
1 4 10;
2 1 12;
2 2 15;
2 3 20;
2 4 45]
I want to extract rows from the matrix as follows: For each consecutive number in the first column extract rows using increment of 2 in the second column. The result will be:
A= [1 2 6;
1 4 10;
2 2 15;
2 4 45]

Best Answer

iwant = A(2:2:end,:)