Compare lists as condition

Frans-Jan Wind's icon

Hi,

I've got 2 lists, both are the same length (18 numbers). I need a function where the value in the left list is passed if the value of the same position in the right list is 1. So the right list only consists of zero's and ones.

continuously changing left list compare list
100 50 99 17.... 0 0 1 1...

This should be let through
0 0 99 17...

This happens about every 30ms in possibly 30 parallel streams, so this should be a fast function. I wandered through the magnificent Lobject library but I could not find a solution.

Any of you a fast working idea?

Thanks, Frans-Jan

hz37's icon
Max Patch
Copy patch and select New From Clipboard in Max.

How about [vexpr $i1 * $i2] where the list with 1's and 0's is the list input of the second inlet and the number list is the input of the first inlet? You will have to bang the second inlet first.

Frans-Jan Wind's icon

This is so amazing simple and fast!
I almost blame myself not thinking of this.
Anyway thanks for this elegant solution.