very easy: how to shift a Matrix left/right?


    Apr 14 2011 | 9:37 am
    Sorry, I've searched the help from top to bottom, but I can't find it.
    I have a simple 2-D Matrix and I'd like to shift all the values one column to the right (in order to jit.poke~ always in the first column).
    jit.resamp has that funcionality, but it only seems to work with a 4-plane-matrix.
    please help me quickly! thanks, simon

    • Apr 14 2011 | 11:03 am
      Hey Ring,
      You can write data to different parts of a matrix by using usedstdim 1. I suppose it would be easiest to set the usedstdim to 1, the dstdimstart to "1 0" and the dstdimend to "width+1 height". Then when you're inputting the matrix into it it will write to the correct location without you having to copy the matrix.
      Reading parts from a matrix can be done by outputting it and using [jit.submatrix] to reference to an area. Takes a little bit of getting used to, but very handy.
    • Apr 14 2011 | 12:45 pm
      take a look at jit.convolve. It does this very well.