unique characters in a cell
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
If I have a cell
x=
'sat'
'satire'
'sa'
'do'
How would I list all the unique letters that appear from the list so say uniqueletters='satiredo'
0 commentaires
Réponse acceptée
Geoff Hayes
le 8 Nov 2015
Max - is the order in your output important? If you use first convert your cell array of strings to a single string using strjoin and then use unique to determine the unique characters, you would get
unique(strrep(strjoin(x'),' ',''))
ans =
adeiorst
Note that we use strrep to replace/remove all the space characters in the joined string.
0 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Characters and Strings dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!