# What wrong in cat ? Two simillar Arrays! ERROR: UndefRefError: access to undefined reference

**URL:** https://discourse.julialang.org/t/what-wrong-in-cat-two-simillar-arrays-error-undefreferror-access-to-undefined-reference/22884
**Category:** General Usage
**Created:** [April 7, 2019, 5:47pm UTC](https://discourse.julialang.org/t/what-wrong-in-cat-two-simillar-arrays-error-undefreferror-access-to-undefined-reference/22884 "2019-04-07T17:47:04Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![programista](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/programista/32/5372_2.png) [@programista](https://discourse.julialang.org/u/programista)
#### Post date: [April 7, 2019, 5:47pm UTC](https://discourse.julialang.org/t/what-wrong-in-cat-two-simillar-arrays-error-undefreferror-access-to-undefined-reference/22884/1 "2019-04-07T17:47:04Z")

</div>

What wrong in cat ? Two simillar Arrays !

> julia\> pole0  
> 3×2 Array{Any,2}:  
> “a” #undef  
> #undef#undef  
> #undef#undef
> 
> julia\> poleL  
> 3×2 Array{Any,2}:  
> “M999” “Tak”  
> #undef “Nie”  
> #undef#undef
> 
> julia\> hcat(pole0,poleL)  
> 3×4 Array{Any,2}:  
> “a” #undef “M999” “Tak”  
> #undef#undef#undef “Nie”  
> #undef#undef#undef#undef
> 
> julia\> vcat(pole0,poleL)  
> ERROR: UndefRefError: access to undefined reference  
> Stacktrace:  
> [1] getindex at .\array.jl:731 [inlined]  
> [2] iterate at .\array.jl:707 [inlined]  
> [3] macro expansion at .\multidimensional.jl:650 [inlined]  
> [4] macro expansion at .\cartesian.jl:64 [inlined]  
> [5] macro expansion at .\multidimensional.jl:644 [inlined]  
> [6] \_unsafe\_setindex!(::IndexLinear, ::Array{Any,2}, ::Array{Any,2}, ::UnitRange{Int64}, ::Base.Slice{Base.OneTo{Int64}}) at .\multidimensional.jl:637  
> [7] \_setindex! at .\multidimensional.jl:631 [inlined]  
> [8] setindex! at .\abstractarray.jl:1006 [inlined]  
> [9] \_typed\_vcat(::Type{Any}, ::Tuple{Array{Any,2},Array{Any,2}}) at .\abstractarray.jl:1299  
> [10] typed\_vcat at .\abstractarray.jl:1305 [inlined]  
> [11] vcat(::Array{Any,2}, ::Array{Any,2}) at C:\cygwin\home\Administrator\buildbot\worker\package\_win64\build\usr\share\julia\stdlib\v0.7\SparseArrays\src\sparsevector.jl:1068  
> [12] top-level scope at none:0
> 
> julia\> cat(pole0,poleL,dims=1)  
> ERROR: UndefRefError: access to undefined reference

> julia\> versioninfo()  
> Julia Version 0.7.0  
> Commit a4cb80f3ed (2018-08-08 06:46 UTC)  
> Platform Info:  
> OS: Windows (x86\_64-w64-mingw32)  
> CPU: Intel(R) Core™ i7-2630QM CPU @ 2.00GHz  
> WORD\_SIZE: 64  
> LIBM: libopenlibm  
> LLVM: libLLVM-6.0.0 (ORCJIT, sandybridge)

---

<div class="post-metadata">

### Author: ![kristoffer.carlsson](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kristoffer.carlsson/32/22_2.png) [@kristoffer.carlsson](https://discourse.julialang.org/u/kristoffer.carlsson)
#### Post date: [April 7, 2019, 5:56pm UTC](https://discourse.julialang.org/t/what-wrong-in-cat-two-simillar-arrays-error-undefreferror-access-to-undefined-reference/22884/2 "2019-04-07T17:56:05Z")

</div>

Any access to an `#undef` element will raise an error. Replace it with e.g. `nothing` or `missing` before concatenating.

---

<div class="post-metadata">

### Author: ![programista](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/programista/32/5372_2.png) [@programista](https://discourse.julialang.org/u/programista)
#### Post date: [April 7, 2019, 6:49pm UTC](https://discourse.julialang.org/t/what-wrong-in-cat-two-simillar-arrays-error-undefreferror-access-to-undefined-reference/22884/3 "2019-04-07T18:49:32Z")

</div>

> [@programista](#):
>
> hcat(pole0,poleL)

But  
hcat(pole0,poleL)  
working ! 😉  
Paul

---

<div class="post-metadata">

### Author: ![programista](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/programista/32/5372_2.png) [@programista](https://discourse.julialang.org/u/programista)
#### Post date: [April 7, 2019, 6:53pm UTC](https://discourse.julialang.org/t/what-wrong-in-cat-two-simillar-arrays-error-undefreferror-access-to-undefined-reference/22884/4 "2019-04-07T18:53:02Z")

</div>

something like this works

> julia\> A=fill(“”,2,3)  
> 2×3 Array{String,2}:  
> “” “” “”  
> “” “” “”
> 
> julia\> B=fill(“”,2,3)  
> 2×3 Array{String,2}:  
> “” “” “”  
> “” “” “”
> 
> julia\> hcat(A,B)  
> 2×6 Array{String,2}:  
> “” “” “” “” “” “”  
> “” “” “” “” “” “”
> 
> julia\> vcat(A,B)  
> 4×3 Array{String,2}:  
> “” “” “”  
> “” “” “”  
> “” “” “”  
> “” “” “”  
> But no missing 😕

---

<div class="post-metadata">

### Author: ![kristoffer.carlsson](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kristoffer.carlsson/32/22_2.png) [@kristoffer.carlsson](https://discourse.julialang.org/u/kristoffer.carlsson)
#### Post date: [April 7, 2019, 6:56pm UTC](https://discourse.julialang.org/t/what-wrong-in-cat-two-simillar-arrays-error-undefreferror-access-to-undefined-reference/22884/5 "2019-04-07T18:56:46Z")

</div>

> [@programista](#):
>
> something like this works

Your example has no `#undef`.

---

<div class="post-metadata">

### Author: ![yuyichao](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/yuyichao/32/20_2.png) [@yuyichao](https://discourse.julialang.org/u/yuyichao)
#### Post date: [April 7, 2019, 7:31pm UTC](https://discourse.julialang.org/t/what-wrong-in-cat-two-simillar-arrays-error-undefreferror-access-to-undefined-reference/22884/6 "2019-04-07T19:31:26Z")

</div>

This should work. So it’s a bug. (Things like copy used to have this bug too but should have been fixed)

---

<div class="post-metadata">

### Author: ![kevbonham](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kevbonham/32/216165_2.png) [@kevbonham](https://discourse.julialang.org/u/kevbonham)
#### Post date: [April 8, 2019, 1:45am UTC](https://discourse.julialang.org/t/what-wrong-in-cat-two-simillar-arrays-error-undefreferror-access-to-undefined-reference/22884/7 "2019-04-08T01:45:08Z")

</div>

Just FYI, you should use backticks (``) rather than `>` to quote your code. [See here](https://discourse.julialang.org/t/psa-make-it-easier-to-help-you/14757)
