필터 지우기
필터 지우기

How to find the lowest value of Dist?

조회 수: 1 (최근 30일)
vinicius lanziotti
vinicius lanziotti 2017년 12월 7일
댓글: Image Analyst 2017년 12월 18일
x=[1 2 3 4 5];
d= [0 10 20 30 40;
10 0 50 60 70;
20 50 0 80 90;
30 60 80 0 100;
40 70 90 100 0];
n=2;
for k=1:n
xp = randperm(numel(x), 2);
x(xp) = x(fliplr(xp))
s = sub2ind(size(d),x(1:end-1),x(2:end ));
Dist = sum(d(s))
end
for k=1:n
xp = randperm(numel(x), 4);
x(xp) = x(fliplr(xp))
s = sub2ind(size(d),x(1:end-1),x(2:end ));
Dist = sum(d(s))
end
lowest_Dist = ?

답변 (1개)

Image Analyst
Image Analyst 2017년 12월 7일
편집: Image Analyst 2017년 12월 7일
Index Dist:
Dist(k) = sum(d(s))
Then, perhaps:
lowest_Dist = min(Dist)
If not, why not?
  댓글 수: 1
Image Analyst
Image Analyst 2017년 12월 18일
Did this work for you, or not??

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Biological and Health Sciences에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by