【发布时间】:2014-11-18 03:12:31
【问题描述】:
我正在加载一个 .csv 文件以在 matlab 中进行一些计算。该文件本身有大约 1600 行,但我只对一个子集感兴趣。
load file.csv; %load file
for i = 400:1200 %rows I am interested in
rh_x= file(i,60); % columns interested, in column 60 for the x, 61 for y
rh_y= file(i,61);
rh_x2 = file(i+1, 60); % next point (x,y)
rh_y2 = file(i+1, 61);
p1 = [rh_x, rh_y];
p2 = [rh_x2, rh_y2];
coord = [p1, p2];
Distan = pdist(coord, 'euclidean'); ****
disp(Distan);
end
我的 Distan 变量(距离公式)中没有存储任何内容,我尝试在其中输入两个点。为什么会这样?我只想计算第 400-1200 帧的第 60 行和第 61 行中所有点对的距离公式。
谢谢。
【问题讨论】:
-
你能打印
coord并确认它是正确的矩阵吗? -
是的,我在上面更改了它并显示它是正确的。
标签: matlab for-loop euclidean-distance