The root issue is that when I have data = Node([1 2 3 4 5 6]), I cannot force data to update elsewhere by simply changing the value of one element (data[][1] = 0). As far as I can tell, I have to assign data[] = [0 2 3 4 5 6], or data[] = data[] after changing just the element etc, which wastes resources and becomes prohibitive for big arrays.
Is there something w/ the equivalent of bash shell’s touch filename that will trigger the equivalent of data[] = data[] without doing the assignment?
using Makie
myn=Node(fill(0, 5))
println(to_value(myn)) #--------> [0,0,0,0,0]
on(println, myn)
myn[] = fill(1, 5) # prints [1,1,1,1,1]
myn[][2:3] = [2,3] # nothing prints
println(to_value(myn)) #----------> [1,2,3,1,1]
And yes I can create an array of nodes anodes = Node.(fill(0,5) and then use onany(println, anodes...) to trigger, but this becomes slow very quickly with size.
In particular, I want an animated image to live update display(f) as the data changes in the spirit of the following code…
using Makie
data = fill(0, (100,100)
f = Figure(resolution = (100,100))
Makie.Axis(f[1, 1], aspect = DataAspect(), xticks = [], yticks=[])
display(f)
image!(data)
for i in [1:10, 11:20, 51:60]
data[i] = fill(1,10)
sleep(.001)
end
I’ve tried many things that don’t quite work… One thing that kind of “worked” was just throwing image!(data) inside the loop; but this creates memory problems b/c the memory from previous images is not released.
How can I do this without reassigning the entire data array?
many many thanks - Makie looks like it can do great things, but i don’t know how to/if i can get it to do the simple things I want ![]()