Function to draw a rubberband line and return the start and end points. Usage: [p1,p2]=rbline; or [p1,p2]=rbline(h); where h is an axis handle. Click the mouse in the plot to define the start point. A rubberband line is drawn between the start point and the current point until the mouse is clicked again. The start point, p1, and the end point, p2, are returned. The figure UserData is not available while this function is running but is restored after it ends.
Nice. I had a problem where, after drawing the rubberband line, subsequently plotted figures would not paint over the previous figure. Adding "hold off" to the end of the code seems to have fixed this.
Very simple if you remember to input the axes and not the image. Works great and easily outputs the endpoints. Code is simple to adjust to your needs.
nice routine. I was trying to find something like that, it seems there's a similar routine at least in Matlab 7, it's called gline. You may find it useful as well.
I have added "drawnow" in the callback function, cuz it seems Matlab 7 does not redraw when erasemode is "normal". Or, you can change the erasemode of the line to "xor" without adding "drawnow".
Wonderful! Just what I was looking for! I modified it for interactive region growing, thanks! (also added drawnow at the end)
Had a problem with the line drawing in R14 on a XP machine. added drawnow; at the end of wbmf function and works well now
Just what I needed! I have modified it to show a rectangle using the two points as opposing corners instead of connecting the dots. THANKS!!!
I was about to try and figure out how to write this then I thought I would check here first. Even used the name I would have used. Works very well. The window motion function is very clever.
simple program, easy to use, taught me something new. easily made mods to work in my app. thanks!