how to store eculidean distance in the cell array after every iteration

1 回表示 (過去 30 日間)
singh
singh 2015 年 5 月 26 日
回答済み: Image Analyst 2015 年 5 月 26 日
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

回答 (1 件)

Image Analyst
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.

カテゴリ

Help Center および File ExchangeLogical についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by