![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/233645/image.jpeg)
Vous suivez désormais cette question
- Les mises à jour seront visibles dans votre flux de contenu suivi.
- Selon vos préférences en matière de communication il est possible que vous receviez des e-mails.
How to enable a figure so that if I click on a point and it will show the value?
Réponse acceptée
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/233645/image.jpeg)
29 commentaires
- I clicked on 3 dots and 3 coordinates were returned to the command window. I used those 3 coordinates to add 3 red X's. You can see 2 on the figure below. The 3rd one is covered up by the data tip. If the coordinates were inaccurate, they would not have matched the 3 points I clicked on.
- I turned on data tips and clicked on those same 3 points to see their coordinates within the plot. One of the data tips is shows below. Those numbers matched my outputs perfectly.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/234111/image.jpeg)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/234215/image.jpeg)
- There is a new nested function "returnSelectedCoordinate()" within the button callback function. This replaces the m file you attached.
- The plot is now a 3D plot but it only shows the (x,y) axes so it appears as a 2D plot. This has the advantage of keeping your data together rather than separating the z coordinates. This was also implemented in my answer.
- The returnSelectedCoordinate() function extracts the (x,y,z) coordinates from the axes so you no longer have to send those coordinates into the function. This is much cleaner and safer. This was also implemented in my answer.
- The returnSelectedCoordinate() function not only prints the (x,y,z) coordinates to the command window but, importantly, it also draws a blue circle around the (x,y,z) output coordinates! It uses the output coordinates and the blue circle correctly is drawn around the point selected. This confirms it's working properly. You can comment that out later.
Plus de réponses (0)
Voir également
Catégories
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Une erreur s'est produite
Impossible de terminer l’action en raison de modifications de la page. Rechargez la page pour voir sa mise à jour.
Sélectionner un site web
Choisissez un site web pour accéder au contenu traduit dans votre langue (lorsqu'il est disponible) et voir les événements et les offres locales. D’après votre position, nous vous recommandons de sélectionner la région suivante : .
Vous pouvez également sélectionner un site web dans la liste suivante :
Comment optimiser les performances du site
Pour optimiser les performances du site, sélectionnez la région Chine (en chinois ou en anglais). Les sites de MathWorks pour les autres pays ne sont pas optimisés pour les visites provenant de votre région.
Amériques
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom(English)
Asie-Pacifique
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)