Forums > MaxMSP

list issue: report index if value is 1

April 20, 2010 | 7:42 am

I need to report the index numbers of an incoming list if the value is 1.

f.e. if the list looks like this:

0 1 1 0 1

the result should be like this:

2 3 5

Hope this makes senses!

Thanks.



Ch
April 20, 2010 | 8:15 am

Hi,

here is one of many ways :

– Pasted Max Patch, click to expand. –

April 20, 2010 | 8:27 am

Using [zl sub] is probably the quickest way.

lh

– Pasted Max Patch, click to expand. –

April 20, 2010 | 8:36 am

Lsearch from the Lobjects collection does this, other than it treating lists as 0 based, which means that it would return 1 2 4. Slap an Ladd after the Lsearch for your one-based desired result.

– Pasted Max Patch, click to expand. –

Viewing 4 posts - 1 through 4 (of 4 total)