Sort does not work

조회 수: 18 (최근 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