The method you are using...remove all elements in the array that aren't matchValue, then when done, counting the number of elements in the array, is not a good way to do this. Instead of the numel method, try looking at your code.
userValues(i) = userValues(i);
does nothing, right? it just sets something equal to itself. so that can go too.
After that, you're actually really close. When the match value equals a uservalue, you want to add one to the variable numMatches...
numMatches = numMatches+1;
You just need to figure out where to put that.