# How to access the element of this type of vector

**URL:** <https://discourse.julialang.org/t/how-to-access-the-element-of-this-type-of-vector/85010>\
**Category:** General Usage\
**Tags:** tuple, vector, matrices\
**Created:** [July 30, 2022, 12:21am UTC](https://discourse.julialang.org/t/how-to-access-the-element-of-this-type-of-vector/85010 "2022-07-30T00:21:15Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Starpower\_Power](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/starpower_power/32/38282_2.png) [@Starpower\_Power](https://discourse.julialang.org/u/Starpower_Power)\
**Post date:** [July 30, 2022, 12:21am UTC](https://discourse.julialang.org/t/how-to-access-the-element-of-this-type-of-vector/85010/1 "2022-07-30T00:21:16Z")

</div>

![image](https://global.discourse-cdn.com/julialang/original/3X/4/1/41124938da01715ff24221fc29c8c4a8da0eab99.png)

I want to access all the 2nd element of this vector.  
exp 1.5588154785672663 , 1.5588154785672663,1.5588154785672663. …  
how without for loop?

---

<div class="post-metadata">

**Author:** ![PeterSimon](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/petersimon/32/25193_2.png) [@PeterSimon](https://discourse.julialang.org/u/PeterSimon)\
**Post date:** [July 30, 2022, 1:30am UTC](https://discourse.julialang.org/t/how-to-access-the-element-of-this-type-of-vector/85010/2 "2022-07-30T01:30:00Z")

</div>

```julia
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

```

---

<div class="post-metadata">

**Author:** ![rocco\_sprmnt21](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rocco_sprmnt21/32/20127_2.png) [@rocco\_sprmnt21](https://discourse.julialang.org/u/rocco_sprmnt21)\
**Post date:** [July 30, 2022, 6:50am UTC](https://discourse.julialang.org/t/how-to-access-the-element-of-this-type-of-vector/85010/3 "2022-07-30T06:50:51Z")

</div>

```julia

vany=[(rand( 4,4), rand()) for _ in 1:100]

last.(vany)

```

or, if the second is not the last

```julia
getindex.(vany, 2)

```
