MATLAB: Calling the row with values in column

calling valuesMATLABmatrix array

Y
1 3
5 6
3 2
7 9
8 5
if Y is matrix , in the the second column we have values 2 and 5 , i want to call the row which is having value 2 and 5 in second column and from a new matrix
[ 3 2
8 5 ]
like this

Best Answer

X = Y( (Y(:,2)==2 | Y(:,2)==5) , :);