Adding points to plots with mouse input from the user

1 回表示 (過去 30 日間)
Jason Goad
Jason Goad 2013 年 9 月 5 日
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!

回答 (1 件)

Simon
Simon 2013 年 9 月 5 日
Hi!
Try "ginput"!

Community Treasure Hunt

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

Start Hunting!

Translated by