# 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

`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`

.

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

`summary`

or`isundefined`

.

## Extended Capabilities

## Version History

**Introduced in R2013b**

## See Also

`iscategory`

| `ismember`

| `summary`

| `isundefined`

| `categories`