Feb 01 2011 | 3:17 pm
    How do you set up a patch so that there is an object that gives you a percentage of squares that are white or black for a matrix displayed in a jit.pwindow for example
    Ideally in a number box that updates as the program runs

    • Feb 01 2011 | 5:56 pm
      look at jit.3m. If it's just b&w image, the mean value of any color should be representative of the % white vs. black (scale 0-255 to 0. - 100.).
    • Feb 02 2011 | 1:45 pm
      thanks David thats a nice simple solution. Cheers.
      If I wanted to develop this further I ahve a question about maths. Awesome I know,
      Now that I have a % of 'life' (white squares at a given time I want to write a mathematical expression that says something like:
      'if life = 'if life = >25% but .....etc for >50% and less than 75% = c3, and >75% = c4
      To wirte an instruction/statement/message like this my head says if I put it between the two objects in question it will act as a sort of 'check' before produceing the outcome.
      is this the case or is it better to have some sort of global message that applies to the patch as a whole? Also im trying to work through some examples with vexpr to try to acheive this - is this the right object to use?
      appreciation in advance
    • Feb 02 2011 | 7:51 pm
      Hi Ali,
      There are a couple ways deal with conditions in Max. Start with if/then, e.g.:
      [if $f1 < 25. then bang]
      Check out the if/then help for more syntax, multiple conditions, etc.