You can use the LOC function to locate all rows of a matrix that are equal to a value. Consider the following example:
If my matrix is
m=[1,3,3,6,7,1,3,9]
then use the following to locate all rows of that matrix that are equal to 3:
loc(m==3)
This returns the following result
[2,3,7]
which is a matrix of row numbers of m that are equal to 3.
If you leave off the loc function and just use m==3, then you get a matrix of 1's and 0's, with a 1 indicating the value is equal to 3.