B = renamecats(A, newNames)
B = renamecats(A, oldNames, newNames)
| Parameter | Description |
|---|---|
| A | Input categorical array. |
| oldNames | Existing category names to rename. |
| newNames | Replacement names. With two inputs, this must provide one name for every category. |
| Parameter | Description |
|---|---|
| B | Categorical array whose category names have been changed without changing category codes. |
renamecats changes category labels while preserving which elements belong to each category.
New names must be valid and unique after the rename operation.
A = categorical({'red','blue'}); B = renamecats(A, 'red', 'rouge'); categories(B)
A = categorical({'red','blue'}); B = renamecats(A, {'bleu','rouge'}); categories(B)
| Version | Description |
|---|---|
| 2.0.0 | initial version |