I have a list of lists. For example,
list = {{0,1,0,1,true},{0,0,0,0,false},{0,1,1,1,true},{1,1,1,1,false},{2,2,2,2,false}}
I'd like to find all lists that have the fifth element set to true. I'm looking for a general method that works for any lists in this format. How can I do this?
In the above example, the result that I'm looking for would be:
{{0,1,0,1,true},{0,1,1,1,true}}
Sorry for such a basic question. I looked through the documentation for lists and couldn't find a way to do this. I'm still fairly new at Mathematica.
trueis a proper symbol, but be aware that Mathematica represents truth values withTrueandFalse(nottrue) – Szabolcs Mar 25 '14 at 15:34Cases[{{0, 1, 0, 1, true}, {0, 0, 0, 0, false}, {0, 1, 1, 1, true}, {1, 1, 1, 1, false}, {2, 2, 2, 2, false}}, {___, true, ___}], see alsoDeleteCasese.g. in this answer – Artes Mar 25 '14 at 15:41