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
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 Exchange 中查找有关 Shifting and Sorting Matrices 的更多信息

产品

版本

R2019b

标签

Community Treasure Hunt

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

Start Hunting!

Translated by