detect position of number in list

newtfish's icon

Hi,

Im in a bit of a pickle here!

I have these lists like this.

0 0 0 1 0 0 0 0 - which represents "4"

or

1 0 0 0 0 0 0 0 - which represents "1"

Im trying to detect where the 1 exists within the list and then output the corresponding position.

However, my list is variable. It could be 8 items long, or even more.

Is there any cool way of doing this?

Im currently using ifs to determine where the position = 1. However, this doesnt handle variable list length.

Would be grateful if anyone has any ideas how to solve this :)

newtfish's icon

Strange how I keep answering my own questions on here. Perhaps just the process of asking them helps me to think of the solution.

Max Patch
Copy patch and select New From Clipboard in Max.

Anyway here is my solution with listfunnel

Wetterberg's icon

hehe.

look up [zl sub] ;)

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

cool solution thanku :)