Given matrix
search in column 2 of matrix for the first time a value exceeds 6 and return the matrix up to that row. The result should be
Mathematica a = {{1, 5}, {2, 3}, {4, 8}, {7, 2}}; Min@Position[a, {x_, y_} /; y > 6] (* 3 *) a[[1 ;; % - 1]]
|
{{1, 5}, {2, 3}} |