Shrink jit.matrix based on cell contents?

jeremystewart87's icon

Hey,

I'm looking for a way to shrink a jitter matrix based on cell contents. I have a very large matrix right now and I wold like to remove any cell that is equal to "0 0". That means that the matrix would go from being larger than 100 x 100 to a variable size that is based on the number of cells that contain a value. I'm obviously not interesting in maintaining cell position, but I'm only interested in a list of the data contained in the cells.

Thanks for your help!

jeremystewart87's icon

On second thought, I just found the jit.spill object, which can only print out a pretty small list. Is there a way to restrict the matrix data before jit.spill so that jit.spill will only receive and output cells with a value != 0 ?

Jesse's icon
Max Patch
Copy patch and select New From Clipboard in Max.

This may work for you.

Jesse's icon
Max Patch
Copy patch and select New From Clipboard in Max.

If you want to get around the list length issue, you can use jit.iter

jeremystewart87's icon

Awesome! Great call on 'jit.iter', totally missed that. Thanks for the examples, this is exactly what I was looking for.