Use length range 1 instead of index
Instead of simply specifying the index ( Int64
) of the desired column, specify a range ( UnitRange{Int64}
) of length 1: 1:1
.
This will cause Julia to save the type of the 2D array ( Array{Int64,2}
) instead of returning the vector ( Array{Int64,1}
).
Edit : the developers discussed this section here (thanks to Colin for pointing me to it ).
julia> alpha = [1 2 3; 4 5 6] 2x3 Array{Int64,2}: 1 2 3 4 5 6 julia> alpha[:,1]
source share