Count occurrences of categorical array elements by category

`B = countcats(`

returns
the number of elements in each category of the categorical array, `A`

)`A`

.

If

`A`

is a vector, then`countcats`

returns the number of elements in each category.If

`A`

is a matrix, then`countcats`

treats the columns of`A`

as vectors and returns the category counts for each column of`A`

.If

`A`

is a multidimensional array, then`countcats`

acts along the first array dimension whose size does not equal`1`

.

`categories`

| `iscategory`

| `ismember`

| `isundefined`

| `summary`

Was this topic helpful?