I want to get some specific values from a Matlab Figure. The number of values can be 3, 5, 10, 50 or any N integer. Like in sample pictures,
I want to get values of A, B, C. in form of e.g A=(430,0.56).
A,B,C are not the part of Plot. I just wrote them in Photoshop help clarify the question.
Note: On every execution of the code input values can be different.
The length of the input values (Graph Values) can also change every time.
3
Answers
First open the figure, then obtain the x and y coordinates of the line with
To obtain the value
yi
at the point with abscissa greater or equal thenxi
you can writeOr you can do a linear interpolation
To extract the values between the points with abscissa
x1
andx2
you can follow both strategies. With the first you could writeThe first line intersects the set of points that follow
x1
with the set of points that precedex2
, and the return the indices. If you choose to interpolate tou can construct a new set of points, and interpolate over that set.If you have a chart and you just want to find out the values of arbitrary points on the chart you can use the
ginput
function or by far the simplest solution is to just use the interactive data cursor built into the figure window.Try this code, Its working for me Code is according to Time and Y figure.