How to count the number of different strings in a string list?

11 次查看(过去 30 天)
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

采纳的回答

Mischa Kim
Mischa Kim 2021-1-18
Hi, use
str = {'AAA','ABB','CDE','ABB','CCR','AAA','FDR'};
numstr = numel(unique(str))
  3 个评论
Richard Cornish
Richard Cornish 2021-4-15
This is useful. I want a frequency plot of each unique string - any ideas?

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 MATLAB 的更多信息

标签

产品


版本

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by