unique characters in a cell

7 ビュー (過去 30 日間)
Max
Max 2015 年 11 月 8 日
回答済み: Geoff Hayes 2015 年 11 月 8 日
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'

採用された回答

Geoff Hayes
Geoff Hayes 2015 年 11 月 8 日
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 件)

カテゴリ

Help Center および File ExchangeCharacters and Strings についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by