Welcome!
I have a set of n matlab matrix with the following structure:
xyz_1 -3,37200000000000 2,80000000000000 5,03400000000000
xyz_2 -2,21700000000000 1,74500000000000 7,45300000000000
.... .................. ................ ................
xyz_n -1,39300000000000 0,00700000000000000 6,35500000000000
where the first column is the name of matrix, while the next three columns are the xyz coordinates. I' am looking for an efficient way to find the nearest neighbor. I would like to give the matrix name and k of potential neighbors as the input parameter then program will find the nearest neighbors giving me the result matrix in the following form:
[nearest_neighbor_name_1; distance_between_quoted_element_and_nearest_neigbor_1
nearest_neighbor_name_2; distance_between_quoted_element_and_nearest_neigbor_2
nearest_neighbor_name_....; distance_between_quoted_element_and_nearest_neigbor_....
nearest_neighbor_name_k; distance_between_quoted_element_and_nearest_neigbor_k]
I tried to use the knnsearch
unfortunately without effect. Thank you for your help!