Comparing two character array

3 visualizzazioni (ultimi 30 giorni)
vedesh Mohit
vedesh Mohit il 8 Mar 2020
Risposto: Walter Roberson il 8 Mar 2020
I have two character arrays, F='(AB'')+(BC)+(C)' and G='(BC'')+(C)+(AB)'. How can I compare all the terms of G to determine if it exist in F?

Risposte (1)

Walter Roberson
Walter Roberson il 8 Mar 2020
Fterms = regexp(F, '\+', 'split');
Gterms = regexp(G, '\+', 'split');
all(ismember(Gterms, Fterms))

Categorie

Scopri di più su Matrices and Arrays in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by