文字が何種類あるかカウントしたい
28 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
丈太郎 森川
am 16 Sep. 2021
Kommentiert: 丈太郎 森川
am 16 Sep. 2021
例えば文字列で['A1';'A1';'A1';'A2';'A2';'B1';'B1';'B2';'B3']であれば、答えは文字がA1,A2,B1,B2,B3の5種類なので5になるコードを教えていただけないでしょうか。文字内容はランダムになりますが、同じ文字は並びます。
ロット管理のイメージです。データは何ロットあるか?
よろしくお願い致します。
0 Kommentare
Akzeptierte Antwort
Kojiro Saito
am 16 Sep. 2021
length(unique(['A1';'A1';'A1';'A2';'A2';'B1';'B1';'B2';'B3'], 'rows'))
length(categories(categorical(cellstr(['A1';'A1';'A1';'A2';'A2';'B1';'B1';'B2';'B3']))))
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Matrix Indexing 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!