MATLAB: How to find y axis value’s opposite x axis value

find

for ex:x=1,2,3,4,5,6;y=2,7,8,9,4,1 i want pick up the y axis (9) opposite x axis value

Best Answer

If both vectors are of same size, find the index of your variable from y and use it to pick the value at that position in x. A simple example is
x = [1 2 3 4];
y = [5 6 7 8];
ind = find(y==7);
x(ind);