Get a point from a graph
조회 수: 11 (최근 30일)
이전 댓글 표시
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
채택된 답변
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
추가 답변 (1개)
Walter Roberson
2011년 2월 15일
You can use a custom datacursormode callback that includes display() in its code.
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!