I have a nested Array and want to repeatedly get the value at a specific location in the array and change it. Is there a way to do this with a pointer to be more compact? I use Julia 1.6.0.
My array looks like this:
Q = Array{Array}(undef, 10,10)
for row in 1:10
for col in 1:10
Q[row,col] = Array{Array}(undef, 5,5)
for i in 1:5
for j in 1:5
Q[row,col][i,j] = zeros(9)
end
end
end
end
My current solution is to set a variable to the array one level above the element and to then change it:
tmp = Q[3,3][2,4]
tmp[5] = 1
What I would like to have is some way to directly address the element:
tmp = Q[3,3][2,4][5]
tmp = 1
This doesn't change the array though. I read something auf the Ref() function but didn't quite manage to use it for getting/changing the element.
Thank you in advance!