Is it possible to implement plot animation within while loop in Julia? I’m trying to translate a code that my professor gave me in Matlab. (Top Opt - Sigmund 99 line matlab code)
It seems both @gif and @animate support only for loops. Since, the iterations to solve the problem depend on problem (and may take long time in case of fine mesh), I’d rather have the plot update per iteration than recording data and using for loop later. But, I just can’t implement it within while loop. Here is a sample for what I’m trying to do.
using Plots
a = ones(10,10)
i = 1
heatmap(a, c =:grays, framestyle = :none, cbar = false)
while i < 11
a[i] += i
i += 1
heatmap!(a)
sleep(1e-4)
end
I have tried this both in terminal and Pluto. Please let me know if there is way to implement this. Thanks!