Forums > MaxMSP

how to decide what input provides the biggest number?

May 6, 2010 | 6:27 pm

Hi,

I have four streams of data, and I want to do realtime analysis of which data stream that provides the biggest numbers.

So far I have made a really clumpsy solution with an if-statement: if$i1>$i2 && $i3 then bang

The problem is that I have to bang the if-statement for input 2 and 3 aso. It soon becomes a pain to deal with more than 2 3 datas treams.

I wonder if there is a list object that can tell at what position in a list the highest value is …

Thanks,

Ana



MIB
May 6, 2010 | 6:41 pm

have a look at [zl sort] and [zl slice]

– Pasted Max Patch, click to expand. –

May 6, 2010 | 7:09 pm

Lpeak from the Lobjects does this.


May 6, 2010 | 7:43 pm

Thanks, yes, I know how to find the biggest number, but what I want to do is to find out from which inlet the biggest number came from (at which position in the list is the biggest number) …


May 6, 2010 | 8:08 pm

Thanks for Lpeak, this is just what I was looking for;-)



MIB
May 6, 2010 | 9:35 pm

use the right outlet from [zl sort] to get the index…


May 6, 2010 | 11:01 pm

FWIW, maximum object outputs the highest value and it’s index.



MIB
May 7, 2010 | 2:02 am

I always forget that you can send lists to [maximum]… thanks for that one


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