I have a binary image, I have two index values, I want to draw a line joining those two indices, The line has all the pixels with zero. How?
A binary image has thousands of "zero/false" pixels and thousands of "one/true" pixels, and thousands or millions of linear indices that identify their location. To draw a line in the overlay, you can use plot() or line() but you'll have to provide a starting (x1,y1) coordinate, and an ending (x2,y2) coordinate like this
plot([x1 x2], [y1 y2], 'ro-', 'LineWidth', 3); line([x1 x2], [y1 y2]);
Obviously you can tailor the options to your liking. If this doesn't help you then you need to better explain your needs, because it's not clear to us. For example, you may want to "burn" a line into the image rather than draw it in the overlay (in which case I have a demo for that, along with dozens of other demos).