292 views (last 30 days)

i search on matlab searching question but not found it.

I have a graph with a curve. I want to know the Y value from my graph

example X = 10

how to find Y?

thx.

Julian Laackmann
on 14 Aug 2012

Edited: MathWorks Support Team
on 9 Nov 2018

Open the figure using “openfig” and return the “Figure” object as an output argument, such as "fig". Then use “fig” to access the underlying objects in the figure.

fig = openfig('MySavedPlot.fig')

For example, if the figure contains a line plot, you might want to get the X and Y data for the line. You can get the X and Y data using the XData and YData properties of the "Line" object. You can access the "Line" object through the "Children" property of the axes. You can access the "Axes" object through the “Children” property of the figure.

ax = fig.Children

ln = ax.Children;

X = ln.XData;

Y = ln.YData;

Image Analyst
on 14 Aug 2012

asma chaudhry
on 11 Sep 2018

Opportunities for recent engineering grads.

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

Start Hunting!
## 4 Comments

## Direct link to this comment

https://au.mathworks.com/matlabcentral/answers/45973-how-do-i-get-object-data-from-a-fig-file-such-as-x-and-y-data#comment_94398

⋮## Direct link to this comment

https://au.mathworks.com/matlabcentral/answers/45973-how-do-i-get-object-data-from-a-fig-file-such-as-x-and-y-data#comment_94398

## Direct link to this comment

https://au.mathworks.com/matlabcentral/answers/45973-how-do-i-get-object-data-from-a-fig-file-such-as-x-and-y-data#comment_94403

⋮## Direct link to this comment

https://au.mathworks.com/matlabcentral/answers/45973-how-do-i-get-object-data-from-a-fig-file-such-as-x-and-y-data#comment_94403

## Direct link to this comment

https://au.mathworks.com/matlabcentral/answers/45973-how-do-i-get-object-data-from-a-fig-file-such-as-x-and-y-data#comment_795623

⋮## Direct link to this comment

https://au.mathworks.com/matlabcentral/answers/45973-how-do-i-get-object-data-from-a-fig-file-such-as-x-and-y-data#comment_795623

## Direct link to this comment

https://au.mathworks.com/matlabcentral/answers/45973-how-do-i-get-object-data-from-a-fig-file-such-as-x-and-y-data#comment_834976

⋮## Direct link to this comment

https://au.mathworks.com/matlabcentral/answers/45973-how-do-i-get-object-data-from-a-fig-file-such-as-x-and-y-data#comment_834976

Sign in to comment.