Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Dragging image objects inside Matlab figure ?

Subject: Dragging image objects inside Matlab figure ?

From: Anoop Cherian

Date: 10 Feb, 2010 01:54:03

Message: 1 of 4

Hi,
I have a requirement that I need to show a set of small images on a Matlab figure and control the position of these images by dragging them using the mouse pointer, with say the left mouse button down (like, the way we arrange icons on a desktop). Is this possible with Matlab? If so, can some one tell me how to achieve this?

Thank you very much,
Anoop Cherian

Subject: Dragging image objects inside Matlab figure ?

From: Jonathan

Date: 16 Feb, 2010 15:05:09

Message: 2 of 4

"Anoop Cherian" <anoop.cherian@gmail.com> wrote in message <hkt3jr$4hr$1@fred.mathworks.com>...
> Hi,
> I have a requirement that I need to show a set of small images on a Matlab figure and control the position of these images by dragging them using the mouse pointer, with say the left mouse button down (like, the way we arrange icons on a desktop). Is this possible with Matlab? If so, can some one tell me how to achieve this?
>
> Thank you very much,
> Anoop Cherian

You want to look at using the 'WindowButtonMotionFcn' property of the figure. Basically the pseudocode for what you want to do is:

1) set a callback for 'WindowButtonDownFcn' and 'WindowButtonUpFcn'
2) When the user clicks the mouse, 'WindowButtonDownFcn' is called and it is here you want to set a callback for 'WindowButtonMotionFcn'
3) This callback for 'WindowButtonMotionFcn' can get the current location of the pointer and update the axes or image position as necessary
4) When the button is released, 'WindowButtonUpFcn' is called. This callback should set 'WindowButtonMotionFcn' = []

Hope this helps.

Subject: Dragging image objects inside Matlab figure ?

From: Jan Simon

Date: 16 Feb, 2010 17:10:28

Message: 3 of 4

Dear Anoop!

> I have a requirement that I need to show a set of small images on a Matlab figure and control the position of these images by dragging them using the mouse pointer, with say the left mouse button down (like, the way we arrange icons on a desktop). Is this possible with Matlab? If so, can some one tell me how to achieve this?

Have you seen Adres Bruns MOVEIT2:
  http://www.mathworks.com/matlabcentral/fileexchange/23304
And Drag and Drop from Scott Hirsch
  http://www.mathworks.com/matlabcentral/fileexchange/4224

Good luck, Jan

Subject: Dragging image objects inside Matlab figure ?

From: Anoop Cherian

Date: 16 Feb, 2010 18:53:03

Message: 4 of 4

Hi Jan,
Thanks so much. Moveit was exactly what I was looking for.

regards
Anoop


"Jan Simon" <matlab.THIS_YEAR@nMINUSsimon.de> wrote in message <hleji4$k3e$1@fred.mathworks.com>...
> Dear Anoop!
>
> > I have a requirement that I need to show a set of small images on a Matlab figure and control the position of these images by dragging them using the mouse pointer, with say the left mouse button down (like, the way we arrange icons on a desktop). Is this possible with Matlab? If so, can some one tell me how to achieve this?
>
> Have you seen Adres Bruns MOVEIT2:
> http://www.mathworks.com/matlabcentral/fileexchange/23304
> And Drag and Drop from Scott Hirsch
> http://www.mathworks.com/matlabcentral/fileexchange/4224
>
> Good luck, Jan

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us