필터 지우기
필터 지우기

Select a certain number of mine Vector Members in MATLAB

조회 수: 2 (최근 30일)
lech king
lech king 2020년 10월 6일
댓글: lech king 2020년 10월 6일
Hi
I have a 40 x 1 vector. I want to find the location of 20 smaller components of this vector. The position of these members is considered.
Thanks for your guidance

채택된 답변

KSSV
KSSV 2020년 10월 6일
Let v be your vector. You can arrange them from small to big order i.e in ascending order and then pick first twenty elements.
[val,idx] = sort(v) ;
val(1:20) % values
idx(1:20) % indices
  댓글 수: 3
KSSV
KSSV 2020년 10월 6일
You already have the indices in your hand as idx which corresponds to original vector. This is not a problem. The positions are according to vector v.
lech king
lech king 2020년 10월 6일
Thank you very very much

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Directed Graphs에 대해 자세히 알아보기

태그

제품


릴리스

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by