# Select elements from list [closed]

I have a the following list:

list = {
{{0,1112},{1600,1110}}, {{0,693},{600,691}}, {{0,134},{1600,132}},
{{1,188},{600,188}}, {{0,413},{1600,411}}, {{0,49},{600, 49}}
}


I want to select all elements where list[[#, 2, 1]] == 600.

The resulting list should be:

{ {{0,693},{600,691}}, {{1,188},{600,188}}, {{0,49},{600,49}} }


I tried the following:

Select[list, list[[#, 2, 1]] == 600 &]


but I get errors:

Part::pkspec1: The expression {{0,1112},{1600,1110}} cannot be used as a part specification. ...

• Select[list, #[[2,1]]==600&] – user1066 Aug 9 '17 at 11:10

Cases[list, x : {_, {600, _}} :> x]


{{{0, 693}, {600, 691}}, {{1, 188}, {600, 188}}, {{0, 49}, {600, 49}}}

I'd probably go for @tomd's Select or @eldo's Cases, to be honest. But for completeness I thought I should add Pick:

Pick[#, #[[2, 1]] == 600 & /@ #] & @ list


(Edit: Or as @JM points out, a cleaner implementation is

Pick[#, #[[All, 2, 1]], 600] & @ list


)

Or you could do something like

If[#[[2, 1]] == 600, #, Nothing] & /@ list


(because who knows, someday you might need it). Both of which give

{{{0, 693}, {600, 691}}, {{1, 188}, {600, 188}}, {{0, 49}, {600, 49}}}