live.grid in Matrix mode – working with the Steps Values outlet
I’m doing some work with live.grid: http://cycling74.com/docs/max5/refpages/m4l-ref/live.grid.html
When live.grid is in Matrix mode, it means that each step (column) can have multiple ‘on’ points.
The second outlet sends a message with details of all the ‘on’ points, as described in the live.grid reference:
Out second outlet: The steps values are sent out this outlet whenever they are changed via the mouse or a message. If the live.grid object is in Matrix Mode, the step value/y value coordinates of all "on" points are sent out the outlet.
So, for a 4×4 grid with all points set to ‘on’, the output message would be:
1 1 1 2 1 3 1 4
2 1 2 2 2 3 2 4
3 1 3 2 3 3 3 4
4 1 4 2 4 3 4 4
(I’ve added line breaks to make it a bit easier to follow).
Or the same grid with just the bottom-left and top-right points set to ‘on’ would be:
1 1 4 4
(also see screenshots)
What’s the best way of taking a list like this (that can vary in length) and doing something useful with it? I think I first need to split the list into co-ordinate pairs. I don’t think I can use unpack, because the length is variable. I searched for a ‘for’ or ‘foreach’ type loop object, but I didn’t find one.
hmm, looks like the object ‘zl delace’ could be a good start…
[route 0] | [zl iter 2] | [unpack i i]
Been away from Max for a while, and I don’t have it with me ATM, but I *think* this is how I do it. IIRC, You need the [route 0] to catch whenever you clear the last step.
disco can you be more specific about what your using it for? I’ve been using live.grid in my current project and I have been equal parts pleased and frustrated by it. Matrixctl is rapidly gaining favour for me.
hey christripledot, thanks for the suggestion of [zl iter 2] – it was just what I needed to divide up the large list into individual x,y coordinates and then forward them onwards individually. Good call on the [route 0] too – although I used a [zl filter 0] instead.
LiamCormacGould – I’m basically taking the output of one grid and then feeding it to a different grid. For a little more info, see my other thread: http://cycling74.com/forums/topic.php?id=37775
What in particular do you find frustrating about live.grid? Maybe I can help.
don’t get me wrong live grid is useful and i like it for what it does. Not having any real problems with it now. I think what I was referring to was the fact that there are only two clickable states on/off. Also that the live grid doesn’t report off squares just on squares. which for what I was doing at the time was annoying.
Yes, the non-reporting of off squares is something I will also have to deal with soon.
If you need to save somewhere and then recall the grid’s state, you need to send it a "clear" message before recalling to put every cell to "off" state.
It took me some time to figure this out…
Forums > Max For Live