Skip to content

addcats

Add categories to a categorical array.

B = addcats(A, newcats)
B = addcats(A, newcats, 'Before', cat)
B = addcats(A, newcats, 'After', cat)

Returns A with the new categories added (no data values change). For ordinal arrays, the position of the new categories matters — control with the 'Before' / 'After' options.

addcats(categorical({'a','b'}), {'c','d'})
  • removecats — Remove categories from a categorical array.
  • mergecats — Merge categories of a categorical array.
  • renamecats — Rename categories of a categorical array.
  • reordercats — Reorder the categories of a categorical array.