Proper way to concatenate higher-dimensional arrays?

Sorry, my example is the same nested loop, just using a more compact syntax. Rewritten with your loop structure,

DatArr = [ElasticMatrix{Float64}(undef, 3, 0) for j = 1:Nj, k = 1:Nk]
for i in 1:5
	for j in 1:Nj
		for k in 1:Nk
			Nrand = rand(1:10)
			xyzVect = ElasticArray{Float64}(undef, 3, 0)
			for n in 1:Nrand
			   append!(xyzVect,rand(3))
			end
			append!(DatArr[j,k], xyzVect)
		end
	end    
end
1 Like