フィルターのクリア

Get a point from a graph

11 ビュー (過去 30 日間)
Ean Soo
Ean Soo 2011 年 2 月 15 日
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

採用された回答

Paulo Silva
Paulo Silva 2011 年 2 月 15 日
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 件のコメント
Ean Soo
Ean Soo 2011 年 2 月 16 日
Thank You, your code help me a lot.
Nasiru Umar Bagudu
Nasiru Umar Bagudu 2022 年 2 月 5 日
What if i want to get the value of x when y is zero for example?

サインインしてコメントする。

その他の回答 (1 件)

Walter Roberson
Walter Roberson 2011 年 2 月 15 日
You can use a custom datacursormode callback that includes display() in its code.
  1 件のコメント
Ean Soo
Ean Soo 2011 年 2 月 16 日
Erm, is not suitable for me in this case because i would want to recall a very precise value like 12.22. I still working on how to recall that thing. Is just didnt work..

サインインしてコメントする。

カテゴリ

Help Center および File Exchange2-D and 3-D Plots についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by