MATLAB: Finding a noninteger value from an array

find

I have an array which looks like:
x = linspace(0,1,101);
To find the index of the maximum point from an array, I can write:
[val,ind] = max(x);
However, I need the index of a particular point, let's say 0.70. How should i write the commands to find this?
My second question is that I have a specific value y = 0.703. I need to do my calculation using the array x, but I have to start from the value in x that is closest to y. Which means I am looking for the index of the point 0.70 in x, but i need to express it in terms of y in my code. How can I do that?

Best Answer

Both questions have the same answer
[~,loc]=min(abs(x-y))