MATLAB: Index multiple columns together on different critera

indexingmatrix array

I have a maxtrix of 2 columns, I want to pull out a new matrix with all the rows where column 1 is <0.2 and column 2 is >0.2. The row values are matched, both columns need to stay together.
A= [0.09 0.48
0.5 0.1
0.04 0.3]
I want make the new matrix to return
B= [0.09 0.48
0.04 0.3]
I've tried things like these, but I only end up with the first column
idx=A(:,1)<0.2 | A(:,2)>0.2;
B=A(idx)
B=[0.09
.04]
How do I return column 2 as well?

Best Answer

B=A(idx, :)