How to fill a matrix with a checkerboard pattern?


    Mar 06 2014 | 5:13 pm
    Does anyone know a nice elegant way to fill a matrix with a checkerboard pattern?
    Let's say for example that the two colours will be cyan and magenta. Also, each square will be just one cell of the matrix.
    I could use uzi and counter to loop through all the odd cells and then all the even cells, but I'm guessing there's a more efficient way.

    • Mar 06 2014 | 7:47 pm
      jit.bfg, check the help, third tab "checker" Would that do ?
    • Mar 06 2014 | 11:04 pm
      Yes, I did see that shortly after I posted! I will experiment... I need to find the right settings so that the pattern matches up perfectly to the resolution of the matrix - one square per cell/pixel.
    • Mar 06 2014 | 11:09 pm
      You could also investigate using [jit.expr] with the cell arguments
    • Mar 07 2014 | 4:44 pm
      I'd say, just do it once with uzi and you're done with it in a few microseconds never to worry about it again.
    • Mar 08 2014 | 12:40 am
      A simple and efficient technique would be to use jit.gen along with [cell] [%] and [
    • Mar 08 2014 | 4:42 am
      Yes, gen is great for cellwise stuff.