Borrar filtros
Borrar filtros

how can ı sort of the matrices

1 visualización (últimos 30 días)
mts
mts el 7 de Jul. de 2018
Comentada: mts el 8 de Jul. de 2018
ı want to sort to this matrice like this but ı dont know how can ı do that? help me pls.
  4 comentarios
Image Analyst
Image Analyst el 7 de Jul. de 2018
Do you have the Statistic and Machine Learning Toolbox? Did you use knnsearch()? See attached demo.
mts
mts el 8 de Jul. de 2018
Editada: mts el 8 de Jul. de 2018
no ı dont have any of them, also my code attached , so how can ı add sort function or put ın an order these values as ı want at first post

Iniciar sesión para comentar.

Respuesta aceptada

Image Analyst
Image Analyst el 8 de Jul. de 2018
Transpose distance so that it has 2 columns. Then call sortrows().
sortedDistances = sortrows(distance', 1);
  3 comentarios
Image Analyst
Image Analyst el 8 de Jul. de 2018
sortrows moves rows together, all columns in lock-step. That's what we want. We do not want to sort the original first row, and then the second row. However the first row gets repositioned, we want the second row to follow along in the very same order. sortrows() takes care of that for you but the data has to be in rows.
mts
mts el 8 de Jul. de 2018
ı understand now. thank you for your help.

Iniciar sesión para comentar.

Más respuestas (0)

Community Treasure Hunt

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

Start Hunting!

Translated by