how to store eculidean distance in the cell array after every iteration
Mostra commenti meno recenti
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
Risposte (1)
Image Analyst
il 26 Mag 2015
0 voti
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.
Categorie
Scopri di più su Descriptive Statistics in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!