[HOW TO?] analysing lists

Mar 30, 2011 at 6:31pm

[HOW TO?] analysing lists

hi guys

Hope everything is just fine with all of you.
I need an hint on how to solve a problem.

I have an input of a list with four elements..

eg: 1 2 3 4

the values are intigers between 0 and 1

I then have a permutation of all those elements (4^2 = 16):

0000
1000
0100
0010
0001
0011
1100
1001
1010
0101
0110
1110
0111
1011
1101
1111

and then I want to analyse this list and detect which one is being triggered..

can you give me an hint on how to do this.. so that I can spend some time on it trying to solve this problem myself?

thanks in advance
tiago morgado

#55949
Mar 30, 2011 at 7:10pm

you can convert this binary representation to an int, then use [sel] to pick which one it is (0-15 are possible). lots of ways to do it.

#201019
Mar 30, 2011 at 7:18pm

ok.. thanks man.. I will try it..

#201020
Mar 30, 2011 at 7:31pm

you mean something like this right?

– Pasted Max Patch, click to expand. –

thanks
tiago morgado

#201021
Mar 30, 2011 at 9:59pm

or this:

– Pasted Max Patch, click to expand. –
#201022
Mar 30, 2011 at 10:12pm

thanks terry.. it’s a much more effective way of solving the problem.. and with a much more advanced programming max level.. in fact it almost seems that you’re making some c++ script by using maxmsp objects

#201023
Mar 30, 2011 at 11:43pm

If you’re interested, have a look at the help patches for these objects: the sprintf object uses C nomenclature, and the jstrigger object uses javascript

#201024
Mar 31, 2011 at 9:21am

If you need to scale this to different numbers of bits then you can use this alone without needing the [sprintf] object.alone without needing the [sprintf] object:

jstrigger (parseInt(parseInt(a.join().replace(',','','g'),2).toString(10)))

#201025
Apr 1, 2011 at 2:19am

in fact sprintf is a c/c++ function..
for simple operation jstrigger seems to be effective and you don’t need to create an external with js objects for putting simple instructions to maxmsp..

thanks guys

#201026

You must be logged in to reply to this topic.