How can I fill an array with empty 2D arrays?

I see. Then perhaps what you actually need is:

a = Array{Array{Float32, 2}, 1}(undef, 3)

which is a Vector (a 1-D Array) whose elements are themselves matrices, with space allocated to hold 3 elements.

You can write that more simply as: Vector{Matrix{Float32}}(undef, 3) if you prefer.

4 Likes