How to count the number of different strings in a string list?
10 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Paramonte
am 18 Jan. 2021
Kommentiert: Steven Lord
am 15 Apr. 2021
Dear All
I would need some help on this:
I have the following string list:
AAA
ABB
CDE
ABB
CCR
AAA
FDR
I would need to count the different strings in this list which is, in this example 5, and this would be my output.
The acual list may have undreds of strings.
Many thanks in advance!
Para
0 Kommentare
Akzeptierte Antwort
Mischa Kim
am 18 Jan. 2021
Hi, use
str = {'AAA','ABB','CDE','ABB','CCR','AAA','FDR'};
numstr = numel(unique(str))
3 Kommentare
Richard Cornish
am 15 Apr. 2021
This is useful. I want a frequency plot of each unique string - any ideas?
Steven Lord
am 15 Apr. 2021
str = {'AAA','ABB','CDE','ABB','CCR','AAA','FDR'};
histogram(categorical(str))
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Characters and Strings finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!