how to find y axis value's opposite x axis value

2 次查看(过去 30 天)
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

采纳的回答

KL
KL 2015-4-29
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);
  2 个评论
Stephen23
Stephen23 2015-4-29
编辑:Stephen23 2015-4-29
Using logical indexing (as per Ilham Hardy's answer) is simpler and faster than using find.

请先登录,再进行评论。

更多回答(1 个)

Ilham Hardy
Ilham Hardy 2015-4-29
>> x=[1,2,3,4,5,6];
>> y=[2,7,8,9,4,1];
>> opp_x = x(y==9)
opp_x =
4

类别

Help CenterFile Exchange 中查找有关 2-D and 3-D Plots 的更多信息

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by