Finding corresponding Y value in matrix with redundant data

I want to find corresponding Y value in matrix with redundant data.
Example:
x = [4 8 2 5 8 2] y = [1 2 3 3 4 5]
I want to get y value of 8. but i can't use indexing as in matlab for redundant data we get index as 1.

Answers (1)

x = [4 8 2 5 8 2];
y = [1 2 3 3 4 5];
l0 = ~ismember(x,y);
out = unique(x(l0));
outidx = find(l0);

Asked:

on 5 Mar 2014

Answered:

on 5 Mar 2014

Community Treasure Hunt

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

Start Hunting!