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

1 view (last 30 days)
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

Answers (1)

Image Analyst
Image Analyst on 26 May 2015
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.

Community Treasure Hunt

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

Start Hunting!