Clear Filters
Clear Filters

Adding points to plots with mouse input from the user

3 views (last 30 days)
I am trying to figure out a way to assign values to variables based on the location of various clicks of a mouse on a .jpg or .png image.
Specifically, I would like to add plots to the orbitals of gravitationally bound binary stars using data from various double star observation catalogues.
So in this example, what I want to be able to do with MATLAB is prompt the user to "Please click on the 0 tick mark and then on the 1 tick mark." Given the x,y coordinates of those tick marks I could then determine how many pixels represent one arcsecond on each individual image. I could then prompt the user to click the center of the image, on the + mark, and that would tell me the x,y coordinate of the center. From that information I could automatically plot the next projected orbit given by the catalogues I mentioned earlier.
Is this at all possible? Is there a better way?
Thank you in advance!

Answers (1)

Simon
Simon on 5 Sep 2013
Hi!
Try "ginput"!

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!