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!