Suppose we have a list of pairs for example $\{\{1,2\},\{-1,2+3i\},\{4,6i\},\{3,4\}\}$
How delete the pairs from a list of pairs if the last element of the pair is complex?
Such that in the above case the second and third elements get removed.
Mathematica Stack Exchange is a question and answer site for users of Wolfram Mathematica. It only takes a minute to sign up.
Sign up to join this communityYou can try this
DeleteCases[{{1, 2}, {-1, 2 + 3 I}, {4, 6 I}, {3, 4}}, {_, _Complex}]
(* {{1, 2}, {3, 4}} *)
For the other cases you can use pattern, built-in functions or user-functions. For example, try to delete elements with negative numbers in the second place
data = {{1, 2}, {-1, -3}, {4, 6}, {3, -4}};
DeleteCases[data, {_, _?((# < 0)&)}]