I am new to matlab. I already have a matrix open in imagesc function. And I want to plot lines by the points gathered from mouse clicks.
This is what I have currently
load('maze', 'A');
% adjust coordinate
hold on;
plot(1,1);
imagesc(A);
% get points from mouse
[x,y] = ginput;
% graph the line
line(x, y, 'Color', 'r');
Now, what I want to achieve is to plot in real time not after finishing all the clicking. If you click once, you see a point on the map, and click twice you see a line on the map. How should I be able to achieve this?