Indexing vector elements of a matrix

I can’t seem to access all elements of equal index in a matrix in an intuitive way.
What I have is a matrix of vectors “scan”
Matrix{Vector{Float64}} (alias for Array{Array{Float64, 1}, 2})
Accessing all elements of the vectors of equal index k in the way that makes sense:
“scan[:,:][k]” does not work, while “[scan[x,y][113] for x=1:64, y=1:64]” does, but is really cumbersome.
What am I missing?

julia> m=reshape( [ rand(1:10,3) for i in 1:9 ] ,3,3)
3×3 Matrix{Vector{Int64}}:
 [3, 1, 5]   [5, 5, 10]  [6, 6, 5]
 [10, 3, 3]  [9, 4, 6]   [7, 8, 3]
 [4, 7, 9]   [5, 7, 5]   [4, 7, 1]

julia> getindex.(m,2)  #get all values with index 2
3×3 Matrix{Int64}:
 1  5  6
 3  4  8
 7  7  7

Is a bit less cumbersome.

2 Likes

And by the way: Welcome!
Always provide MWE (minimal working example), thats makes it much easier to comprehend the question :slight_smile:
See Please read: make it easier to help you