Effacer les filtres
Effacer les filtres

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

5 vues (au cours des 30 derniers jours)
Lukas Netzer
Lukas Netzer le 3 Mai 2021
Commenté : Lukas Netzer le 3 Mai 2021
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!

Réponse acceptée

KSSV
KSSV le 3 Mai 2021
REad about hist.
xbins = unique(Location);
[counts,centres] = hist(Location,xbins);
R = [centres counts]

Plus de réponses (0)

Catégories

En savoir plus sur MATLAB dans Help Center et File Exchange

Produits


Version

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by