MATLAB: Conditional equation X1=X(y==1)

MATLAB

I have a matrix X and a column vector y. When I write something like X1=X(y==1), I only get the numbers from the first column of X. How to get numbers from all others columns when y==1 ?

Best Answer

X1=X(y==1,:)