count_vals_byname function

Count the number of matrix entries that meet a criterion