Note: This page has been translated by MathWorks. Please click here

To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

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?