Being a novice, I'm having trouble with the following: I have a list of lists and want only those elements where the second element of the second level is positive. So, for example, from
list1={{1,-1},{12,4},{8,-6},{2,2},{3,-1},{4,4}}
I want to get
list2={{12,4},{2,2},{4,4}}
I know that it has to be easy, but I've tried
list2=Select[list1,list1[[1,2]]]>0
I've tried setting list2={{},{}} and then
For[j=1,j<=Length[list1],j++,If[list1[[j,2]]>0,Append[list2,list1[[j]]]]]
and a few things that I've forgotten. I know that it has to be easy but I've spent an hour on it and am out of patience!
Select[list1, #[[2]] > 0 &]– BlacKow Mar 08 '17 at 22:04Pick[#, UnitStep@#[[All, 2]], 1] &@list1– user1066 Mar 08 '17 at 22:35Select[Last /* Positive] @ list1– Simon Woods Mar 08 '17 at 22:56