countcats
Count occurrences of categorical array elements by category
Description
B = countcats( returns the number of elements in
each category of a categorical array. The counts are in the same order as the
categories listed by the A)categories function.
If
Ais a vector, thencountcatsreturns the number of elements in each category.If
Ais a matrix, thencountcatstreats the columns ofAas vectors and returns the category counts for each column ofA.If
Ais a multidimensional array, thencountcatsacts along the first array dimension whose size does not equal1.
To display a summary of a categorical array that shows both category names and the
number of elements in each category, use the summary function.
Examples
Input Arguments
Tips
To find the number of undefined elements in a categorical array, you must use
summaryorisundefined.
Extended Capabilities
Version History
Introduced in R2013b
See Also
iscategory | ismember | summary | isundefined | categories

