Why the result in my two matrixctrl are different?

Wynd's icon

Hello!


I have been struggling for hours now to understand why I can't obtain the result of [a] in [b]...

I know I could use preset to save the matrixctrl state but I want to try with [coll].

Thank you!

Max Patch
Copy patch and select New From Clipboard in Max.

TFL's icon

The reason why it doesn't work is because when you click cells in A, it sends some output (the modified cell), filling the [zl.group]. So when you dump your [matrixctrl] with a [bang], that dump will be truncated. A possible solution is to have a [gate] before your [zl.group] that opens just when you dump the data for storing them:

Max Patch
Copy patch and select New From Clipboard in Max.

Wynd's icon

Tank you so much!!!

I thought the counter should be triggered first so it sends the index to [coll]

TFL's icon

I thought the counter should be triggered first so it sends the index to [coll]

It really depends on your logic. I omitted to explain that change I did but I'm glad you noticed it.

In your version, you first trigger [counter], which will in turn trigger [zl.join] since it is connected to its hot inlet. But if you just opened your patch [zl.join] haven't received the dump from [matrixctrl] yet, so it will just send a 1, which will recall the first line of your [coll] instead of storing the dump into it.

Then, the next time you will click on your bang button, it will first trigger [counter], which will send a 2 to [zl.join] which in the meantime has received the dump from your previous bang. So you will be storing your first dump into line 2, then your second dump it line 3, etc. which doesn't really make sense to me.

Maybe you are missing the notion of hot (red) and cold (blue) inlets. It's explained here in the doc.

In my version, first I send the dump to [zl.join], which will remain silent until it receives something in its hot inlet, which will be the index given by [counter]. So my first dump will correctly be stored in the first line of [coll].