counts = countcats(A)
counts = countcats(A, dim)
| Parameter | Description |
|---|---|
| A | Input categorical array. |
| dim | Dimension along which counts are computed. Supported values are 1 and 2. |
| Parameter | Description |
|---|---|
| counts | Counts in category order. Undefined elements are not counted. |
countcats counts how many elements belong to each category of A.
For matrices, dim controls whether categories are counted down columns or across rows.
A = categorical({'red','blue','red',''}); counts = countcats(A)
A = categorical({'red','blue'; 'red','red'}); counts = countcats(A, 2)
| Version | Description |
|---|---|
| 2.0.0 | initial version |