@朝雨浥轻尘 这个不难,你需要写个代码来订阅数据,数据是个数组,你把每个数据遍历一遍,计算每个中心点的欧式距离,选择最小的那个的id记录下来.具体编程操作像这样子:
https://www.runoob.com/cprogramming/c-examples-smallest-array-element.html
#include <stdio.h>
int main() {
int array[10] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 0};
int loop, smallest;
smallest = array[0];
for(loop = 1; loop < 10; loop++) {
if( smallest > array[loop] )
smallest = array[loop];
}
printf("最小元素为 %d", smallest);
return 0;
}