How to find the unique elements in multiple strings?

26 Ansichten (letzte 30 Tage)
Leon
Leon am 8 Mai 2020
Beantwortet: Akihumi am 8 Mai 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!

Akzeptierte Antwort

Akihumi
Akihumi am 8 Mai 2020
unique([strsplit(A,', '), strsplit(B,', ')])

Weitere Antworten (0)

Kategorien

Mehr zu Characters and Strings finden Sie in Help Center und File Exchange

Tags

Produkte


Version

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by