MATLAB: How to find all elements in a matrix row containing a specific value

find matrix row specific value elements contain

First of all, my apologies if this has been asked. I have checked, and I've seen somewhat similar questions, but still can't get my code to work.
Anyway, I have a matrix
Conn=[1 2;2 3;3 4;1 4;2 4]
I need to be able to find all of the elements in a row that contains a specific value — in this case, 3. So rows 2 and 3 of the Conn matrix contain the value 3; I need all of the other elements in those rows (so 2 and 4). How would I go about coding this? I know it's just calling rows/columns from the matrix and probably using the find command, which should be simple for someone more experienced, but I can't get it to work.
Thanks, –Aaron

Best Answer

Use the two output version of find (that is get the rows and columns), and use the rows as index:
[row, ~] = find(Conn == 3);
Conn(row, :)