Getting the 3 lowest values in a vector Matlab

2 ビュー (過去 30 日間)
Teoman Selcuk
Teoman Selcuk 2021 年 11 月 17 日
編集済み: Jan 2021 年 11 月 17 日
How would I be able to get the 3 minimum values from a vector of values, starting from the lowest one to the higher values?
a = [12,3,9, 5.6, 9, 10, 7]
Expected Output:
[3, 5.6, 7]

回答 (1 件)

Jan
Jan 2021 年 11 月 17 日
編集済み: Jan 2021 年 11 月 17 日
a = [12,3,9, 5.6, 9, 10, 7];
b = mink(a, 3)
b = 1×3
3.0000 5.6000 7.0000

カテゴリ

Help Center および File ExchangeMatrices and Arrays についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by