# How does one add rows to a Julia array?

**URL:** <https://discourse.julialang.org/t/how-does-one-add-rows-to-a-julia-array/24056>\
**Category:** New to Julia\
**Created:** [May 10, 2019, 2:13am UTC](https://discourse.julialang.org/t/how-does-one-add-rows-to-a-julia-array/24056 "2019-05-10T02:13:43Z")\
**Posts on this page:** 1\
**Showing post:** 6

<div class="post-metadata">

**Author:** ![Martin\_Florek](https://avatars.discourse-cdn.com/v4/letter/m/f4b2a3/32.png) [@Martin\_Florek](https://discourse.julialang.org/u/Martin_Florek)\
**Post date:** [July 1, 2020, 7:41am UTC](https://discourse.julialang.org/t/how-does-one-add-rows-to-a-julia-array/24056/6 "2020-07-01T07:41:39Z")

</div>

[Concatenation](https://docs.julialang.org/en/v1/manual/arrays/#man-array-concatenation-1) need to create new a array and it’s very inefficiently! because the [vcat](https://docs.julialang.org/en/v1/base/arrays/#Base.vcat) function is used

```Julia
julia> @which [A;m']
vcat(A::Union{Array{T,1}, ...

```

Multidimensional arrays in Julia are stored in column-major order. A good discussion is

> [@Silly question. How to add a row to array?](https://discourse.julialang.org/t/silly-question-how-to-add-a-row-to-array/33601/10):
>
> A 2d Array is inherently a bad data structure if you want to add rows dynamically. Julia arrays are stored column-major (contiguous columns), which means that even if you resized the memory to accommodate a new row, you would need to insert a new element into each column by moving every column in memory. One possibility here is to use an vector of arrays, e.g. julia\> a = [[2,3], [5,6]] 2-element Array{Array{Int64,1},1}: [2, 3] [5, 6] julia\> push!(a, [1,2]) 3-element Array{Array{Int64,1},1…

---

_[View the full topic](https://discourse.julialang.org/t/how-does-one-add-rows-to-a-julia-array/24056)._
