Makes no sense -- you start off with no C but then the description of the development of the content of C is dependent upon existing C content.
Try again to describe what A and B contain and what merge operation you're after.
Probably a short(ish) example would ease the comparison.
Look at the various join operations and/or ismember and related friends...