Effacer les filtres
Effacer les filtres

Use ButtonDownFcn on an image

4 vues (au cours des 30 derniers jours)
J.S.
J.S. le 9 Juil 2018
Commenté : J.S. le 11 Juil 2018
I have a (pixelated) image that has been created from an array of data using the function imagesc(). I would like to click on a pixel and be able to a)obtain the coordinates of the pixel in the figure window, and b)pass these values to a piece of code (to be created) which "finds" what the data values at those coordinates were, and displays the data values in a new figure window. Is such an extraction method, where I am not,say,clicking on a line or axis of a bar graph, possible using the ButtonDownFcn?
  5 commentaires
Adam
Adam le 11 Juil 2018
I would use functions rather than scripts, but scripts do at least allow nested functions now so you can create your callback as a function at the bottom of your script, to do whatever you want it to with the 'CurrentPoint'.
This function will be called every time you click on whatever you have attached it to, so if this is the axes (assuming you have turned the hittest of the image off) then each time you click the axes the function will trigger so no loops should be needed.
J.S.
J.S. le 11 Juil 2018
Thanks!

Connectez-vous pour commenter.

Réponses (0)

Catégories

En savoir plus sur Graphics Object Programming dans Help Center et File Exchange

Produits


Version

R2015b

Community Treasure Hunt

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

Start Hunting!

Translated by