how can I find the smallest 3 numbers in a matrix array?

5 ビュー (過去 30 日間)
Ararat Cetinkaya
Ararat Cetinkaya 2020 年 2 月 8 日
編集済み: per isakson 2020 年 2 月 8 日
Hi everyone,
I have a matrix array with dimensons 1x91. I want to find smallest 3 numbers in this array, how can ı find ?
Thanks for you answers

採用された回答

Walter Roberson
Walter Roberson 2020 年 2 月 8 日
mink(TheArray, 3)
  2 件のコメント
Ararat Cetinkaya
Ararat Cetinkaya 2020 年 2 月 8 日
Can ı find the locations of the datas, if I write [a,b]=mink(thearray,3)
per isakson
per isakson 2020 年 2 月 8 日
編集済み: per isakson 2020 年 2 月 8 日
>> m = rand(1,12);
>> [ mn, ix ] = mink(m,3)
mn =
0.035712 0.14189 0.42176
ix =
10 4 5
>> m(ix)
ans =
0.035712 0.14189 0.42176

サインインしてコメントする。

その他の回答 (1 件)

KSSV
KSSV 2020 年 2 月 8 日
編集済み: KSSV 2020 年 2 月 8 日
A = rand(1,91) ;
[val,idx] = sort(A) ;
iwant = val(1:3)
locations = idx(1:3)
  2 件のコメント
Ararat Cetinkaya
Ararat Cetinkaya 2020 年 2 月 8 日
Actually, I need the loacations of the arrays too, beacuse of that ı think this will not usefull. thnx for your answer.
KSSV
KSSV 2020 年 2 月 8 日
Getting locations is also possible....edited the answer. Check it.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeLogical についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by