I have the following list I want to pick elements from:
mylist = {1, 5, 7, 3, 4, 7, 2, 9, 9, 1, 10, 12, 2, 64, 34, 64}
I have another list with 0's and 1's which is my selector:
selector = {1, 1, 1, 0, 0, 1, 1, 0, 1, 1, 1, 0, 0, 0, 1, 1}
I want to select all the entries from mylist
where selector
has a 1. I know I can do this via:
Pick[mylist,selector,1]
BUT: Pick gives me all the selected elements from mylist
together like this:
{1, 5, 7, 7, 2, 9, 1, 10, 34, 64}
I want the elements which are separated in selector
by a 0 to be separate lists. That is, as a result I want to have a list of lists like this:
{{1,5,7},{7,2},{9,1,10},{34,64}}
Any help appreciated!