Sort does not work

20 visualizaciones (últimos 30 días)
RF01
RF01 el 8 de Oct. de 2019
Respondida: RF01 el 8 de Oct. de 2019
Am I missing something very obvious or does the built-in sort function not work as it is supposed to?sort.png

Respuesta aceptada

Stephan
Stephan el 8 de Oct. de 2019
Editada: Stephan el 8 de Oct. de 2019
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...

Más respuestas (1)

RF01
RF01 el 8 de Oct. de 2019
Thanks Stefan, you are right!

Categorías

Más información sobre Shifting and Sorting Matrices en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by