Data extract from graph.

15 ビュー (過去 30 日間)
Vikas Vasudevan
Vikas Vasudevan 2019 年 6 月 26 日
回答済み: Walter Roberson 2019 年 6 月 26 日
I have a plot I created in matlab using excel data. I would like my code to provide a Y value for the X value that I provide. Is this possible? Please note that i cannot look for the Y value, the code should automatically assign the Y value from the graph for provided X value.
Thanks for the Help.

採用された回答

Walter Roberson
Walter Roberson 2019 年 6 月 26 日
Providing that x is monotonic:
h = findobj(gca, '-property', 'XData');
hx = h.XData;
hy = h.YData;
[shx, idx] = sort(hx);
shy = hy(hx);
corresponding_y = interp1(shx, shy, given_x);

その他の回答 (0 件)

カテゴリ

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