Locate Y given X and display on the graph
조회 수: 1 (최근 30일)
이전 댓글 표시
Hello ,
I have been trying to display the value of X and Y given either X or Y on my graph but am unable to do so. I would also like to be able to add in additional info/text and be able to re-size the box. The following was done through of the Data Cursor function which is not accurate. Please help , thanks.
Regards , Haziq
댓글 수: 0
답변 (5개)
Ilham Hardy
2014년 12월 30일
You can 'extract' the Data Cursor information to workspace for more accurate number. Right click on the data cursor point >> Export cursor data to workspace.
댓글 수: 0
RuiQi
2014년 12월 30일
댓글 수: 1
Sean de Wolski
2014년 12월 30일
To do this correctly, you'd have to get the x/y data from the line and then use interp1 to get you the value of y at x == 3.
Sean de Wolski
2014년 12월 30일
편집: Sean de Wolski
2014년 12월 30일
h = plot(cumsum(rand(1,10)),rand(1,10));
valueICareAbout = 3;
yICareAbout = interp1(h.XData,h.YData,valueICareAbout) % R2014b syntax
댓글 수: 0
Ilham Hardy
2014년 12월 30일
Refering to your description,
If you generate the graph yourself using plot function, then simply interpolates your xpoint to find the applicable ypoint.
Please see,
doc interp1
댓글 수: 2
Sean de Wolski
2014년 12월 30일
Even if not generating the plot yourself, you could use findobj to traverse the graphics tree.
참고 항목
카테고리
Help Center 및 File Exchange에서 Specifying Target for Graphics Output에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!