Asked by uncung fgv
on 14 Aug 2012

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.

Answer by Julian Laackmann
on 14 Aug 2012

Edited by MathWorks Support Team
on 9 Nov 2018

Accepted Answer

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;

uncung fgv
on 14 Aug 2012

my plot in matlab file. actually the curve is hyperbolic. X data is heigh

Y is velocity

so I want to find E=1/2 mv^2.

I have m data it is ok to find one by one Y data. by using Data Cursor. I want find many Y data from this plot.

uncung fgv
on 14 Aug 2012

i mean how to get data from figure file.

Image Analyst
on 14 Aug 2012

Sign in to comment.

Answer by uncung fgv
on 14 Aug 2012

Thx, guys, i already find it on this:

Sign in to comment.

Answer by asma chaudhry
on 11 Sep 2018

Sign in to comment.

Opportunities for recent engineering grads.

Apply Today
## 2 Comments

## MRR (view profile)

Direct link to this comment:https://www.mathworks.com/matlabcentral/answers/45973-how-do-i-get-object-data-from-a-fig-file-such-as-x-and-y-data#comment_94398

## uncung fgv (view profile)

Direct link to this comment:https://www.mathworks.com/matlabcentral/answers/45973-how-do-i-get-object-data-from-a-fig-file-such-as-x-and-y-data#comment_94403

Sign in to comment.