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
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/146632/image.jpeg)
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!