Using unique-function - show amount of times unique value was found

1 回表示 (過去 30 日間)
Lukas Netzer
Lukas Netzer 2021 年 5 月 3 日
コメント済み: Lukas Netzer 2021 年 5 月 3 日
Hey,
I am using:
[C, ia, ic] = unique(Location);
Now I get a list of unique Locations in Location but am actually looking for the amount of times each location is in there. E.g.:
C Times
Location 1 5
Location 2 8
Location 3 2
etc..
Is there a way to do that?
thanks for your help!

採用された回答

KSSV
KSSV 2021 年 5 月 3 日
REad about hist.
xbins = unique(Location);
[counts,centres] = hist(Location,xbins);
R = [centres counts]
  1 件のコメント
Lukas Netzer
Lukas Netzer 2021 年 5 月 3 日
Thanks - still so much to figure out :)

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

その他の回答 (0 件)

カテゴリ

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

製品


リリース

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by