6.3.21 Counting elements equal to a given value
The
count_eq
command counts the number of elements of a list equal to a given value.
count_eq takes two arguments:
x
, a real number.
L
, a list or matrix of real numbers.
count_eq(
x
,
L
)
returns the number of elements of
L
which are equal to
x
.
Example
count_eq
(12,[2,12,45,3,7,78])
1