How to find the unique elements in multiple strings?

조회 수: 27 (최근 30일)
Leon
Leon 2020년 5월 8일
답변: Akihumi 2020년 5월 8일
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!

채택된 답변

Akihumi
Akihumi 2020년 5월 8일
unique([strsplit(A,', '), strsplit(B,', ')])

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Characters and Strings에 대해 자세히 알아보기

태그

제품


릴리스

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by