필터 지우기
필터 지우기

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.

Community Treasure Hunt

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

Start Hunting!

Translated by