how to store eculidean distance in the cell array after every iteration
1 次查看(过去 30 天)
显示 更早的评论
i know the coordinates of the node and i calculate the distance between two nodes.but i have some problem to store the result in the cell array
X1 =
4.3874 7.5127
3.8156 2.5510
7.6552 5.0596
7.9520 6.9908
1.8687 8.9090
for i=1:5
X=X1(i,1)
Y=X1(i,2)
for i2=i+1:5
X2=X1(i2,1)
Y2=X1(i2,2)
dist11=[X,Y;X2,Y2];
dist12=pdist(dist11,'euclidean')
end
end
now i wish to store the nonzero dist12 values in the cell array
0 个评论
回答(1 个)
Image Analyst
2015-5-26
You don't need a cell array because a regular numerical array will be good enough. For that matter, you don't need for loops either since pdist() does that for you internally.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Logical 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!