Appending to a multidimensional array

Check out tho documentation of cat you can specify the dimension along which you want to concatenate N-dimensional arrays:

1D:

julia> append!([1, 2, 3], [4, 5, 6])        # mutating!
6-element Array{Int64,1}:                   
 1                                          
 2                                          
 3                                          
 4                                          
 5                                          
 6                                          
                                            
julia> cat(1, [1, 2, 3], [4, 5, 6])         
6-element Array{Int64,1}:                   
 1                                          
 2                                          
 3                                          
 4                                          
 5                                          
 6      

Generalization:

julia> cat(2, [1, 2, 3], [4, 5, 6])         
3×2 Array{Int64,2}:                         
 1  4                                       
 2  5                                       
 3  6                                       
                                            
julia> cat(3, [1 2 ;3 4], [5 6 ; 7 8])      
2×2×2 Array{Int64,3}:                       
[:, :, 1] =                                 
 1  2                                       
 3  4                                       
                                            
[:, :, 2] =                                 
 5  6                                       
 7  8                                       
3 Likes