Consider this vector
v = [
(1, [[11, 11, 11], [12, 12, 12]]),
(2, [[21, 21, 21], [22, 22, 22]]),
(3, [[31, 31, 31], [32, 32, 32]]),
(4, [[41, 41, 41], [42, 42, 42]]),
]
I want to get from v the following vector vv
4-element Vector{Any}:
[[11, 11, 11], [21, 21, 21], [31, 31, 31], [41, 41, 41]]
[[11, 11, 11], [22, 22, 22], [32, 32, 32], [42, 42, 42]]
[[12, 12, 12], [21, 21, 21], [31, 31, 31], [41, 41, 41]]
[[12, 12, 12], [22, 22, 22], [32, 32, 32], [42, 42, 42]]
I tried
re = []
for i in 1:length(v[1][2])
res = []
for j in 1:length(v)
push!(res, copy(v[j][2][i]))
end
push!(re, res)
end
which give me only two vectors
[[11, 11, 11], [21, 21, 21], [31, 31, 31], [41, 41, 41]]
[[12, 12, 12], [22, 22, 22], [32, 32, 32], [42, 42, 42]]