how can ı sort of the matrices

1 次查看(过去 30 天)
ı want to sort to this matrice like this but ı dont know how can ı do that? help me pls.
  4 个评论
Image Analyst
Image Analyst 2018-7-7
Do you have the Statistic and Machine Learning Toolbox? Did you use knnsearch()? See attached demo.
mts
mts 2018-7-8
编辑:mts 2018-7-8
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

请先登录,再进行评论。

采纳的回答

Image Analyst
Image Analyst 2018-7-8
Transpose distance so that it has 2 columns. Then call sortrows().
sortedDistances = sortrows(distance', 1);
  3 个评论
Image Analyst
Image Analyst 2018-7-8
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 2018-7-8
ı understand now. thank you for your help.

请先登录,再进行评论。

更多回答(0 个)

Community Treasure Hunt

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

Start Hunting!

Translated by