Let your input be defined as
data = [ 10 75 20 30 67 50 85 12 30 98 49 70]; values = [ 30 67];
This should be pretty fast:
index = data(:,1)==values(1) & data(:,2)==values(2); %// logical index to matching rows result = data(index,3); %// third-column value for those rows
This gives all the values ββof the third column, which must match if there should be more than one.
If you want to specify several pairs of values ββat once and get all the matching results:
index = any(bsxfun(@eq, data(:,1).', values(:,1)), 1) & ... any(bsxfun(@eq, data(:,2).', values(:,2)), 1); result = data(index,3);
For example, given
data = [ 10 75 20 30 67 50 85 12 30 98 49 70 30 67 80 ]; values = [ 30 67 98 49];
the result will be
result = 50 70 80
source share