Subscript indices must either be real positive integers or logicals.
조회 수: 1 (최근 30일)
이전 댓글 표시
Hi,
dist = sqrt((r1 - r2) ^ 2 + (c1 - c2) ^ 2);
costs(i) = 1 /ceil( dist) * exp(- abs(ceil(img(abs(r1), abs(c1))) - ceil(img(abs(r2),abs(c2)))) ^ 2 / (2 * sigma ^ 2));
c2 is equal to 0 ,so it returns Subscript indices must either be real positive integers or logicals.
Thanks
댓글 수: 0
채택된 답변
Image Analyst
2016년 5월 9일
편집: Image Analyst
2016년 5월 9일
If c2 is zero, img(abs(r2), 0) won't work. Make sure it's not zero.
추가 답변 (1개)
Azzi Abdelmalek
2016년 5월 9일
Check if abs is not used as a variable in your code. You can check by writing
whos abs
You can resolve the problem by typing
clear abs
abs(c2)
댓글 수: 2
Azzi Abdelmalek
2016년 5월 9일
You don't think, but have you tried to check it buy typing?
which abs
clear abs
abs(0)
참고 항목
카테고리
Help Center 및 File Exchange에서 Introduction to Installation and Licensing에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!