I have this function below, but the if statement inside the for loop doesn't work. I tried <= instead of < and also round(), but they didn't work.
function points1=tracker(count1,points1,u,v,I2)
for j=1:count1
if (points1(1,j) < size(u,1))&&(points1(2,j) < size(u,2))
points1(1,j)= points1(1,j)+v(points1(1,j),points1(2,j));
points1(2,j)= points1(2,j)+u(points1(1,j),points1(2,j));
I2(round(points1(1,j)),round(points1(2,j)))=255;
else
points1(:,j)=[];
count1=count1-1;
j=j-1;
end
end
figure, imshow(I2)
end