How to find the unique elements in multiple strings?

23 visualizaciones (últimos 30 días)
Leon
Leon el 8 de Mayo de 2020
Respondida: Akihumi el 8 de Mayo de 2020
I have strings like the below. It can be 1 or can be more than 20. Here is an example with just 2 strings>
A = "CTDTMP, CTDSAL, CTDOXY, Silicate, Phosphate";
B = "CTDTMP, CTDSAL, CTDOXY, Ammonium";
How do I generat C as the below?
C = "CTDTMP, CTDSAL, CTDOXY, Silicate, Phosphate, Ammonium"
Thanks!

Respuesta aceptada

Akihumi
Akihumi el 8 de Mayo de 2020
unique([strsplit(A,', '), strsplit(B,', ')])

Más respuestas (0)

Categorías

Más información sobre Characters and Strings en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2020a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by