One list comparision with several lists

    Mar 19 2014 | 1:17 pm
    Hi. A little bit stuck with lists.
    I want to do something like this:
    If [list_0] equal [list_1] Then (set 1) Else If [list_0] equal [list_2] Then (set 2) Else If [list_0] equal [list_3] Then (set 3) Else (set 4)

    • Mar 19 2014 | 6:53 pm
      Here's a simple solution which should give you an idea...
    • Mar 19 2014 | 7:16 pm
      Another one, bit more easy to expand and configure
    • Mar 20 2014 | 12:40 pm
      this is just a variation on Lee's work using uzi.
      I think it's nice to use zero as the output if there is no match.
    • Mar 20 2014 | 2:54 pm
      i would use expr (as we know)
      [zl compare] [zl compare] [zl compare] [zl compare] [expr ($i1=1) + ($i2=1)*2 + ($i3=1)*3 + ($i4=1)*4]
      this, as well as the solutions by the others, wont work when more than one condition is true.
    • Mar 20 2014 | 8:53 pm
      Thanks all. I think the best solution for me is to use 4 [] with [expr]. But it's all not so good... None of the algorythms is working with my setup, because of some bug, or i don't know. [] somehow is not comparing complex lists even if they are equal. But with simple lists everything is ok. Here is example.
    • Mar 20 2014 | 11:07 pm
      it looks like it's got something to do with rounding error in floating point representation in max. here's a version which 'works', if the magnitudes are rounded to the nearest 1/64 (-36db error)
    • Mar 21 2014 | 12:08 pm
      Thanks, for help. I thought about that this problem is with lists in message boxes which are already rounded.
    • Mar 21 2014 | 1:57 pm
      And if you're just interesting in finding the closest list, you can use zsa.dist:
    • Mar 21 2014 | 10:44 pm
      Sorry, Emmanuel, but my max4live version is not supporting this library even in 32bit compatibility mode.
    • Mar 22 2014 | 12:53 am
      use this expression to truncate the rounding error to 6 decimal places vexpr int($f1 * 1000000.)/1000000.
      this will give you a -140db error
    • Mar 22 2014 | 11:32 am
    • Mar 22 2014 | 8:08 pm
      @ivnos it should work both in 32 or 64 bits. At least that's what I'm seeing here using the latest versions of Max, Live and zsa.descriptors. Feel free to contact me if you're still experiencing some problems.
    • Mar 23 2014 | 12:47 pm
      Floating Point, thanks again, but your previous variant were enough. =)
      eltopo, sorry but i don't understand your patch.
      Emmanuel, sorry, forgot to install it properly (forgot to copy it into packages).