MATLAB: Specifying range of data from a plot?

dataplotting

This is my plot:
x=1:5;
y=rand(size(x));
lh=line(x,y);
xp=get(lh,'xdata');
yp=get(lh,'ydata');
I understand the above code…but now I want to know the values of x when it has a specific relation to y.
How would I code that I want to know the values for x when y is equal or greater to a new variable n?
Something like: xSelect = get(lh,'xdata' if y>=n) ???? not sure how to code what I want.
Thanks for the help!

Best Answer

xSelect = x(y>=n);