Skip to content

mergecats

Merge categories of a categorical array.

B = mergecats(A, oldcats)
B = mergecats(A, oldcats, newcat)

Combines the categories named in oldcats (a cell array) into a single category. With newcat, names the merged category; otherwise, uses the first name in oldcats.

C = categorical({'red', 'green', 'blue'});
mergecats(C, {'red', 'green'}, 'warm')
  • addcats — Add categories to a categorical array.
  • removecats — Remove categories from a categorical array.
  • renamecats — Rename categories of a categorical array.