Split data into groups

조회 수: 2 (최근 30일)
Happy Bear
Happy Bear 2020년 6월 3일
댓글: Happy Bear 2020년 6월 3일
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

채택된 답변

Stephan
Stephan 2020년 6월 3일
편집: Stephan 2020년 6월 3일
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
Happy Bear
Happy Bear 2020년 6월 3일
Thank you!

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

Community Treasure Hunt

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

Start Hunting!

Translated by