Forums > Jitter

pushing/popping from a matrix


pmt
March 15, 2013 | 3:29 am

Hi

I have a 3 plane matrix where x = 60 and y = 1 (a simple array), and I’m wondering if there is any object/function (or a well established design pattern), for popping or shifting a cell off of a matrix and moving every other cell over by one? conversely, is there an established function or pattern for pushing an item onto a matrix and shifting every cell over by one? many thanks!

Peter


March 15, 2013 | 7:22 am

Probably you want to use jit.split and jit.concat for this. See attached:

– Pasted Max Patch, click to expand. –

Best, Jeremy



dtr
March 15, 2013 | 9:10 am

Or do some matrix positioning gymnastics (srcdimxxx & dstdimxxx attributes), see Jitter tutorial 14.



pmt
March 15, 2013 | 12:44 pm

thanks! i’ll check those both out. it also occurred to me that array manipulation with shift/push in JS might be easier (and just send the adjusted array/list into a matrix on each bang).


Viewing 4 posts - 1 through 4 (of 4 total)