File Exchange

image thumbnail

Drag Line in GUI

version (6.73 KB) by Gero Nootz
Lines in the GUI can be dragged


Updated 18 Jun 2013

View License

run DragLineGUI.m

This demo is modeled after Doug Hull excellent demo @:
but has been revised to work in a file created with GUIDE.
The two lines can be dragged with the mouse and the positions can be passed to the command window by pressing the push button.
It also shows how to pass the GUI handles to the user defined callback functions in the same way GUIDE does.

Cite As

Gero Nootz (2020). Drag Line in GUI (, MATLAB Central File Exchange. Retrieved .

Comments and Ratings (5)

Juan Conde


I want to use a picture as a background to measure a distance.
Is that possible?

I have a problem, i need drag a line in a GUI but using uipanel instead of axis. . .
The name 'WindowButtonUpFcn' is not an accessible property for an instance of
class 'uicontrol'.

I changed .axes1 for .uipanel1

Error in interfazAnotacion>slider1_Callback (line 430)
set(hObject, 'WindowButtonUpFcn',


Thank You Gero Nootz, This is the thing I was looking for :)

MATLAB Release Compatibility
Created with R2011a
Compatible with any release
Platform Compatibility
Windows macOS Linux