removecats
Remove categories from a categorical array.
📝Syntax
B = removecats(A)
B = removecats(A, oldCategories)
📥Input Arguments
Parameter Description
A Input categorical array.
oldCategories Categories to remove. If omitted, unused categories are removed.
📤Output Arguments
Parameter Description
B Categorical array with a reduced category list.
📄Description

removecats removes categories from the category list.

Elements that belonged to removed categories become undefined. When oldCategories is omitted, only unused categories are removed.

💡Examples
Remove an unused category.
A = categorical({'red','blue'}, {'red','blue','green'}); B = removecats(A, 'green'); categories(B)
Remove a used category and create undefined elements.
A = categorical({'red','blue','green'}); B = removecats(A, 'green'); isundefined(B)
🔗See Also
addcatssetcatsmergecatsisundefined
🕔Version History
Version Description
2.0.0 initial version
Edit this page on GitHub