Find an array in a MATLAB matrix

I have a matrix in matlab as follows:

1 1 1 2 2 1 3 3 0.075 12 3 0.025 4 4 1 5 5 1 6 6 1 

I'm trying to find the value of the third column, given that VALUE, and not the index of the first two columns, lets say: 12.3. Then it should output 0.025. I tried using the ismember and find function, but I cannot figure out how to solve the problem in MATLAB.

+4
source share
1 answer

ismember works fine here if you (1) load only the first two columns of A into a function and (2) use the "rows" option with this function:

 A = [1 1 1 2 2 1 3 3 0.075 12 3 0.025 4 4 1 5 5 1 6 6 1] idx = ismember(A(:,1:2), [12 3], 'rows'); % find index of valid row A(idx, 3) % query third column of valid row 

The result is

 ans = 0.0250 
+5
source

Source: https://habr.com/ru/post/1469160/