Sort does not work

5 次查看(过去 30 天)
RF01
RF01 2019-10-8
回答: RF01 2019-10-8
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
Thanks Stefan, you are right!

类别

Help CenterFile 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