Get a point from a graph
11 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Ean Soo
le 15 Fév 2011
Commenté : Nasiru Umar Bagudu
le 5 Fév 2022
Hie guys, I have done a GUI to plot a graph. Now i would like to get the calue from the graph. Lets say i plot(x,y). I would like to get the value out, for example when x=4, what is the value of y. I know there is a datacursormode, but it only show me the value in the graph. In this case, i would like to get the value in the command window.
Thanks Ean
0 commentaires
Réponse acceptée
Paulo Silva
le 15 Fév 2011
You can retrieve the plotted data, for example:
XData=get(get(gca,'children'),'XData');
YData=get(get(gca,'children'),'YData');
Now if you want to know the y value when x=4 just do
YData(XData==4)
6 commentaires
Plus de réponses (1)
Walter Roberson
le 15 Fév 2011
You can use a custom datacursormode callback that includes display() in its code.
Voir également
Catégories
En savoir plus sur 2-D and 3-D Plots dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!