how we can select 2 or more variables from an array depending on their values.

like i have an array of say 100 variables.i want to select 4 variables from this array whose values are maximum in that array.what kind of command is available rather than max in matlab?

1 件のコメント

anu
anu 2013 年 11 月 27 日
max allows selection of only one variable.

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

 採用された回答

Andrei Bobrov
Andrei Bobrov 2013 年 11 月 27 日
編集済み: Andrei Bobrov 2013 年 11 月 27 日
[value1,index1] = sort(A,'descend');
out = [value1(1:4),index1(1:4)];

その他の回答 (1 件)

anu
anu 2013 年 11 月 28 日

0 投票

but it does not work if two or more values are same ..then it is not able to select only one value from them..

カテゴリ

ヘルプ センター および File ExchangeShifting and Sorting Matrices についてさらに検索

タグ

質問済み:

anu
2013 年 11 月 27 日

コメント済み:

anu
2013 年 11 月 28 日

Community Treasure Hunt

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

Start Hunting!

Translated by