how to get the half max numbers after sorting in descending order

조회 수: 1 (최근 30일)
Maheen Fazal
Maheen Fazal 2019년 1월 30일
댓글: KSSV 2019년 1월 30일
Hi, suppose i have a vector E containing values = [90 12 43 20 78 51 32 55], i use sort command to sort them in decending order, but now i want half of them means there are 8 values in the array and want to access only the 1st 4 maximum values separately and last 4 minimum values in a separate Array which are sorted descendingly ,how shall i access them?

채택된 답변

KSSV
KSSV 2019년 1월 30일
편집: KSSV 2019년 1월 30일
F = A(1:4) ;
S = F(5:end) ;
OR
A = [90 12 43 20 78 51 32 55] ;
A = sort(A) ;
iwant = reshape(A,[],2)' ;
  댓글 수: 3
Maheen Fazal
Maheen Fazal 2019년 1월 30일
and then if we want to flag these maximum values and the minimum values separately??to use them further in any calculation?

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Shifting and Sorting Matrices에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by