フィルターのクリア

hello.can any one tell me how can I find 5 lowest values in a vector without replacement?

1 回表示 (過去 30 日間)
farimah amn
farimah amn 2016 年 7 月 30 日
コメント済み: Image Analyst 2016 年 7 月 30 日
for example: A=[3 4 5 1 2 7 3 9 0 1 4 5 7 3 0 8]; and the answer is:B=[1 2 0 1 0];

回答 (1 件)

Azzi Abdelmalek
Azzi Abdelmalek 2016 年 7 月 30 日
編集済み: Azzi Abdelmalek 2016 年 7 月 30 日
A=[3 4 5 1 2 7 3 9 0 1 4 5 7 3 0 8]
[ii,jj]=sort(A)
idx=sort(jj(1:5))
out=A(idx)
  2 件のコメント
farimah amn
farimah amn 2016 年 7 月 30 日
I tried it.it works greatly. thanks a billion
Image Analyst
Image Analyst 2016 年 7 月 30 日
Another way to "thank" someone is to "Accept" their answer to give them reputation points.

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

カテゴリ

Help Center および File ExchangeLoops and Conditional Statements についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by