MATLAB: Can anyone please help me to understand the problem here? I keep getting the error “Index exceeds matrix dimensions”.

digital image processing

for i = 1:length(circles)
if (circles(i,1) ~= 0 & peaks(i,2) ~= 0)
xp = peaks(3,i).*cos(ang);
yp = peaks(3,i).*sin(ang);
end
end

Best Answer

Replace length(circles) by size(circles,1)