Dear all,
How do I convert an object of type Array{Array{Float64,1},2}
to an object of type Array{Float64, 2}
?
For ex.
> t = Array{Array{Float64,1}, 2}(undef, (2, 2))
> t[1] = [0., 0, 0];
> t[2] = [0., 0, 0];
> t[3] = [2., 2, 2];
> t[4] = [2., 2, 2];
> t
2×2 Array{Array{Float64,1},2}:
[0.0, 0.0, 0.0] [2.0, 2.0, 2.0]
[0.0, 0.0, 0.0] [2.0, 2.0, 2.0]
> t2 = Array{Float64, 3}(undef, 2, 2, 3)
> t2[1,1,1] = 0.
> t2[1,1,2] = 0.
> t2[1,1,3] = 0.
> t2[2,1,1] = 0.
> t2[2,1,2] = 0.
> t2[2,1,3] = 0.
> t2[1,2,1] = 2.
> t2[1,2,2] = 2.
> t2[1,2,3] = 2.
> t2[2,2,1] = 2.
> t2[2,2,2] = 2.
> t2[2,2,3] = 2.;
t2
2×2×3 Array{Float64,3}:
[:, :, 1] =
0.0 2.0
0.0 2.0
[:, :, 2] =
0.0 2.0
0.0 2.0
[:, :, 3] =
0.0 2.0
0.0 2.0
The steps to convert t
to t2
.