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

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)

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

2 Likes

But
hcat(pole0,poleL)
working ! :wink:
Paul

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 :confused:

Your example has no #undef.

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

Just FYI, you should use backticks (``) rather than > to quote your code. See here