if I have a vector of 20 elements, how can I extract the 5 minimum elements in that vector

3 ビュー (過去 30 日間)
V=[23,56,12,90,45,21,56,10,70,100,15,...] a=[10,12,15,21,23]

採用された回答

Walter Roberson
Walter Roberson 2017 年 12 月 2 日
sort() and take the first 5 elements of the output.

その他の回答 (1 件)

Steven Lord
Steven Lord 2017 年 12 月 2 日
If you're using release R2017b or later, use the mink function.

カテゴリ

Help Center および File ExchangeShifting and Sorting Matrices についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by