Select a certain number of mine Vector Members in MATLAB

2 次查看(过去 30 天)
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.

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Mathematics 的更多信息

标签

产品


版本

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by