I want to access all the 2nd element of this vector.
exp 1.5588154785672663 , 1.5588154785672663,1.5588154785672663. …
how without for loop?
julia> x = [[1,2,3], [4,5,6], [7,8,9]]
3-element Vector{Vector{Int64}}:
[1, 2, 3]
[4, 5, 6]
[7, 8, 9]
julia> map(t -> t[2], x)
3-element Vector{Int64}:
2
5
8
vany=[(rand( 4,4), rand()) for _ in 1:100]
last.(vany)
or, if the second is not the last
getindex.(vany, 2)
3 Likes