We assumed to have 10 coordinate points. which index is minimum?
(1.80010698 , 4.014570409) (9.748210988 , 2.411989898) (13.42264438 , 868.0535382) (11.24015951 , 3.870002979) (1.689561544 , 2.297184285) (1.887080244 , 2.019336807) (9.932550154 , 1.457111369) (9.184472568 , 2.521589242) (5.061231021 , 2.800199182) (3.343124515 , 2.478806307)
I want to plot only the marked points. The rest of them do not matter.
clc;
close all;
load('MyMatFileName.mat');
[m, ~] = size(inputs);
x = inputs(inputs(:,end-1) < 5 & inputs(:,end) < 2, end-1);
y = inputs(inputs(:,end-1) < 5 & inputs(:,end) < 2, end);
plot(x, y, 'or', 'linewidth', 1.5);
grid on
之外才匹配短语
答案 0 :(得分:0)
我猜你在谈论距离x,y坐标的距离。
您可以使用毕达哥拉斯定理计算与原点的距离。
示例代码:
for i = 1:length(coordinates)
L(i) = (x(i)^2 + y(i)^2)^0.5;
end
[I,minL] = min(L);
其中I
是最小索引,minL
是最小距离。