MATLAB: Draw a line on an image

imageline

Hello
I want draw a line on an image, just by giving the coordinates of the extremities.
I tryed the function line(…) but it didn't give me the right result

Best Answer

Pay attention of the syntax of line().
line([x1,x2],[y1,y2]), not line([x1,y1],[x2,y2]);
figure(1);line([0 1],[0 1]); will show a line
figure(2);line([0 0],[1 1]); won't show a line