Selecting the highest value from a stream of five different channels and determining its source
Hello,
I need to detect the highest value coming in from different sensors which I can do, but then I have to know where this value came from in order to know where to send it to. I am using the Axion Muse headband and receiving simultaneously five different values for the five different brainwaves, delta, theta, alpha, beta, and gamma. By comparing their values I can tell which value is the highest but my problem is then how to determine to which brainwave the result belongs?
For example I can compare two numbers like that: [if $f1 > $f2 then $f1 else $f2], then two other numbers, and then the last two results to get the highest value, but in the process I don't know anymore to which brainwave the result belongs ?
Any suggestions?
I would pack the incoming data and use zl.sort. It gives you the sorted list on the left output and the index order on the right output.
for only five it is tempting to use expr...
( (($f1>f2)&& ($f1>f3)&& ($f1>f4)&& ($f1>f5)*1 ) + ( ((f2>$f1)&& .... )*2 ) + ...
Thanks a lot Pedro, your patch is the solution. Now I can route the sensors to where I want them to go.
Cheers
@ Roman, thanks for your reply, but the syntax is long and I get error message "args truncated".
hrhr, yes that can be that it gets too long already