B = setcats(A, newCategories)
| Parameter | Description |
|---|---|
| A | Input categorical array. |
| newCategories | Complete replacement category list. |
| Parameter | Description |
|---|---|
| B | Categorical array using exactly the categories listed in newCategories. |
setcats replaces the category list of a categorical array.
Elements whose previous category is not present in newCategories become undefined. Categories in newCategories that were not previously present are added as unused categories.
A = categorical({'red','blue','green'}); B = setcats(A, {'red','blue'}); isundefined(B)
A = categorical({'red','blue'}); B = setcats(A, {'red','blue','green'}); categories(B)
| Version | Description |
|---|---|
| 2.0.0 | initial version |