Maybe this is what you're looking for:
julia> bins = Array[[] for i=1:5,j=1:5]
5x5 Array{Array{T,N},2}:
Any[] Any[] Any[] Any[] Any[]
Any[] Any[] Any[] Any[] Any[]
Any[] Any[] Any[] Any[] Any[]
Any[] Any[] Any[] Any[] Any[]
Any[] Any[] Any[] Any[] Any[]
julia> push!(bins[1,1], 0)
1-element Array{Any,1}:
0
julia> bins
5x5 Array{Array{T,N},2}:
Any[0] Any[] Any[] Any[] Any[]
Any[] Any[] Any[] Any[] Any[]
Any[] Any[] Any[] Any[] Any[]
Any[] Any[] Any[] Any[] Any[]
Any[] Any[] Any[] Any[] Any[]
On Friday, October 30, 2015 at 9:12:39 AM UTC-4, Cameron Zachreson wrote:
>
> Hello,
>
> Just started using Julia and I've come across an issue trying to create
> and append values to arrays of empty arrays.
>
> What I want to do is create a grid of empty arrays that can be filled with
> values associated with particle IDs for a molecular dynamics-style
> simulation. The trouble I'm having is that it does not seem possible to
> initialize the arrays so that they can be iteratively filled.
>
> here is an example of the problem:
>
> julia> bins = Array(Array, 5, 5)
>
>
> 5x5 Array{Array{T,N},2}:
>
> #undef #undef #undef #undef #undef
>
> #undef #undef #undef #undef #undef
>
> #undef #undef #undef #undef #undef
>
> #undef #undef #undef #undef #undef
>
> #undef #undef #undef #undef #undef
>
>
> julia> bins[1, 1] = 0
>
>
> ERROR: MethodError: `convert` has no method matching
> convert(::Type{Array{T,N}}, ::Int64)
>
> This may have arisen from a call to the constructor Array{T,N}(...),
>
> since type constructors fall back to convert methods.
>
> Closest candidates are:
>
> call{T}(::Type{T}, ::Any)
>
> convert(::Type{Array{T,N}}, ::SharedArray{T,N})
>
> convert{T,N}(::Type{Array{T,N}}, ::AbstractArray{T,N})
>
> ...
>
> in setindex! at array.jl:314
>
> I don't understand what the error message means, I have tried initializing
> with different datatypes, but it does not work. Any help would be
> appreciated.
>
> Cam
>
>
>
>