MATLAB: How to get values out of a scatter plot that are in between the data points

MATLABplotspline demo

Ok, so I have a dataset with a column of x values and a column of y values. I have plotted them as a scatter plot here.
What I want to do is extract x values for a given y value. E.g. what are the x values when y = 17? As you can see, a given y value might not actually have a "plotted" x value.

Best Answer

You could try spline() or interp1(). See attached demo.
Red points are the original "knots" and the blue points are the interpolated points.
You can maybe reverse the x and y and plug the y into spline to get the x.
Or else make a few million interpolated points and use ismembertol(), though there may be a more direct and accurate way such as finding the two points on either side of hte y value and using bilinear interpolation.