Am I missing something very obvious or does the built-in sort function not work as it is supposed to?sort.png

 採用された回答

Stephan
Stephan 2019 年 10 月 8 日
編集済み: Stephan 2019 年 10 月 8 日

1 投票

Why? for me the indices are correct sorted. The smallest value is found at pos. 3 and the biggest value is found in pos. 4. What is the problem?
Note that the documentation says:
[B, I] = sort(X)
you changed it to:
[I, B] = sort(X)
So maybe what you expect to get is stored in variable I - not B...

その他の回答 (1 件)

RF01
RF01 2019 年 10 月 8 日

0 投票

Thanks Stefan, you are right!

カテゴリ

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

製品

リリース

R2019b

タグ

質問済み:

2019 年 10 月 8 日

回答済み:

2019 年 10 月 8 日

Community Treasure Hunt

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

Start Hunting!

Translated by