countcats
Count occurrences of each category.
Syntax
Section titled “Syntax”n = countcats(A)n = countcats(A, dim)Description
Section titled “Description”Returns the count of values in each category of A. Result is a numeric vector with one entry per category, in the canonical category order.
Examples
Section titled “Examples”C = categorical({'a','b','a','c','a'});countcats(C) % [3; 1; 1]See also
Section titled “See also”summary— Summary of a categorical array.categories— List of category names in a categorical array.