Clear Filters
Clear Filters

Subscript indices must either be real positive integers or logicals.

1 view (last 30 days)
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

Accepted Answer

Image Analyst
Image Analyst on 9 May 2016
Edited: Image Analyst on 9 May 2016

More Answers (1)

Azzi Abdelmalek
Azzi Abdelmalek on 9 May 2016
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 Comments
sbei arafet
sbei arafet on 9 May 2016
Hi, thanks, i don't think it's the problem since abs works with other variables,i've checked it but it does'nt , the problem that the 0 is not considered as positive

Sign in to comment.

Categories

Find more on Introduction to Installation and Licensing in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!