Hi,
Let’s consider an array X
of two dimensions, here X[1,1]
is of type Array{Float64, 2}
, i.e. n = 2
:
julia> X
2×2 Array{Array{Float64,2},2}:
[0.0 0.0; 0.0 0.0; 0.0 0.0] [2.0 2.0; 2.0 2.0; 2.0 2.0]
[2.0 2.0; 2.0 2.0; 2.0 2.0] [2.0 2.0; 2.0 2.0; 2.0 2.0]
I obtain y
from X
by doing:
julia> [y[i,j,:,:] = X[i,j] for i in 1:size(X, 1) for j in 1:size(X, 2)]
Now for the general case when X[1][1]
is of type Array{Float64, n}
where n ∈ ℕ
, what can I do to get y
for general n
in similar way?
pseudo-code would be:
julia> [y[i,j,:,:,:,:,:,.....] = X[i,j] for i in 1:size(X, 1) for j in 1:size(X, 2)]