Split data into groups

5 vues (au cours des 30 derniers jours)
Happy Bear
Happy Bear le 3 Juin 2020
Commenté : Happy Bear le 3 Juin 2020
Hi,
How can I split data into 3 groups? For example, if I have 300 values, I want 100 lowest values in 1 group, 100 highest values in 1 group and the in-between values in another group.
Thank you

Réponse acceptée

Stephan
Stephan le 3 Juin 2020
Modifié(e) : Stephan le 3 Juin 2020
A = randi(5000,300,1); % random data
A = sortrows(A); % sort it
low = A(1:100); % just use indexing now
mid = A(101:200);
high = A(201:300);
  1 commentaire
Happy Bear
Happy Bear le 3 Juin 2020
Thank you!

Connectez-vous pour commenter.

Plus de réponses (0)

Community Treasure Hunt

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

Start Hunting!

Translated by