Hey Robbie,
The DAT execute can be a real brain buster. I never know how much python a person has experience with, so please excuse me if any of the below feels too explicit.
The value of ‘cells’ is actual a list of all of the cell objects that have changed. In your case you might find inconsistent results if you’re not careful. Take a look at this example:
base_dat_execute.tox (2.51 KB)
Notice that you can use a toggle to print either the results from noise 1 changing, or from table 1 changing.
Noise1 one has several values that change at a regular interval. You’ll notice that more than just printing the value of cells we need to run a for loop over the list of values:
[code]def onCellChange(dat, cells, prev):
print_string = “the cell row is {row}, the cell col is {col}, the cell val is {val}”
print("Noise 1 Changing")
print("- "*10)
for each_cell in cells:
formatted_str = print_string.format(row=each_cell.row, col=each_cell.col, val=each_cell.val)
print(formatted_str)
return[/code]
This will return a result like:
[code]Noise 1 Changing
the cell row is 0, the cell col is 0, the cell val is -0.06780897
the cell row is 1, the cell col is 0, the cell val is -0.04219285
the cell row is 2, the cell col is 0, the cell val is -0.02128557[/code]
The result from our for loop tells us which cells have changed, their row and col, as well as the value of the cell.
Compare this to table1. Here a pulse CHOP triggers a script that only updates a single cell at a time, cycling through all cells. This uses nearly an identical script, but our output should look like:
[code]Table 1 Changing
the cell row is 2, the cell col is 0, the cell val is 0.021346164867281914[/code]
Here we only get a single value that’s changed even though there are three cells in the table.
I bring all this up as you want to make sure you know which cell’s values you care about changing when working with a DAT execute - otherwise you can end up with values that change in ways that seem confusing.
I hope that helps nudge you closer to your answer.