フィルターのクリア

Counting amount of digit occurrence in a cell

2 ビュー (過去 30 日間)
M
M 2021 年 5 月 11 日
回答済み: Star Strider 2021 年 5 月 11 日
I have this cell just with simple numbers, and I would like to count how many times each digit is repeated in this whole celll, so for example if this one would've had just 9 rows, as an output I'd like to see that i have seven two's, one three and one nine.
  1 件のコメント
M
M 2021 年 5 月 11 日
I've just found the answer:
1) I changed it into regular array
cell2mat(GOid_ALLProteins)
Then i used
[GC,GR] = groupcounts(x)
which i found as an answer for similar question there:

サインインしてコメントする。

採用された回答

Star Strider
Star Strider 2021 年 5 月 11 日
Try something like this —
CellArray = num2cell([2; 2; 2; 2; 2; 2; 2; 3; 9]);
[Uc,~,ix] = unique([CellArray{:}],'stable');
Count = accumarray(ix,1);
Col1 = Uc(:);
Result = table(Col1,Count)
Result = 3×2 table
Col1 Count ____ _____ 2 7 3 1 9 1
.

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeFunctions についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by