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

조회 수: 1 (최근 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 CenterFile Exchange에서 Shifting and Sorting Matrices에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by