# Converting a vector of static arrays

**URL:** <https://discourse.julialang.org/t/converting-a-vector-of-static-arrays/74448>\
**Category:** General Usage\
**Tags:** question, structarrays\
**Created:** [January 12, 2022, 12:42am UTC](https://discourse.julialang.org/t/converting-a-vector-of-static-arrays/74448 "2022-01-12T00:42:34Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ufechner7](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ufechner7/32/51363_2.png) [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Post date:** [January 12, 2022, 12:42am UTC](https://discourse.julialang.org/t/converting-a-vector-of-static-arrays/74448/1 "2022-01-12T00:42:34Z")

</div>

I have the following data structure:

```julia
using KiteUtils
syslog=demo_syslog(7)
syslog.Z

```

Output:

```julia
201-element Vector{StaticArrays.MVector{7, Float32}}:
 [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
 [0.0, 0.0007690057, 0.0030974336, 0.007050112, 0.012737092, 0.02031671, 0.030000001]
 [0.0, 0.0015380114, 0.006194867, 0.014100224, 0.025474183, 0.04063342, 0.060000002]
 [0.0, 0.002307017, 0.009292301, 0.021150336, 0.038211275, 0.060950134, 0.09]
 [0.0, 0.0030760227, 0.012389734, 0.028200448, 0.050948367, 0.08126684, 0.120000005]
 [0.0, 0.0038450283, 0.015487167, 0.03525056, 0.06368546, 0.101583555, 0.15]
 ⋮
 [0.0, 0.1499561, 0.60399956, 1.3747718, 2.483733, 3.9617586, 5.8500004]
 [0.0, 0.15072511, 0.60709697, 1.3818219, 2.49647, 3.9820752, 5.8800006]
 [0.0, 0.15149412, 0.6101944, 1.388872, 2.509207, 4.002392, 5.9100003]
 [0.0, 0.15226312, 0.6132918, 1.3959222, 2.521944, 4.022709, 5.9400005]
 [0.0, 0.15303212, 0.6163893, 1.4029722, 2.5346813, 4.0430255, 5.9700003]
 [0.0, 0.15380114, 0.6194867, 1.4100224, 2.5474184, 4.063342, 6.0000005]

```

I want to have an array z with the following content:

```julia
201-element view(::RecursiveArrayTools.VectorOfArray{Float32, 2, Vector{StaticArrays.MVector{7, Float32}}}, 7, :) with eltype Float32:
 0.0
 0.030000001
 0.060000002
 0.09
 0.120000005
 0.15
 ⋮
 5.8500004
 5.8800006
 5.9100003
 5.9400005
 5.9700003
 6.0000005

```

Is there an easy way to achieve that?

---

<div class="post-metadata">

**Author:** ![lmiq](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/lmiq/32/18314_2.png) [@lmiq](https://discourse.julialang.org/u/lmiq)\
**Post date:** [January 12, 2022, 12:46am UTC](https://discourse.julialang.org/t/converting-a-vector-of-static-arrays/74448/2 "2022-01-12T00:46:25Z")

</div>

Maybe

```julia
last.(v)

```

---

<div class="post-metadata">

**Author:** ![ufechner7](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ufechner7/32/51363_2.png) [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Post date:** [January 12, 2022, 12:49am UTC](https://discourse.julialang.org/t/converting-a-vector-of-static-arrays/74448/3 "2022-01-12T00:49:00Z")

</div>

Indeed, this works:

```julia
julia> last.(syslog.Z)
201-element Vector{Float32}:
 0.0
 0.030000001
 0.060000002
 0.09
 0.120000005
 0.15
 ⋮
 5.8500004
 5.8800006
 5.9100003
 5.9400005
 5.9700003
 6.0000005

```

Thank you!

Before I used:

```julia
julia> @view VectorOfArray(syslog.Z)[end,:]
201-element Vector{Float32}:
 0.0
 0.030000001
 0.060000002
 0.09
 0.120000005
 0.15
 ⋮
 5.8500004
 5.8800006
 5.9100003
 5.9400005
 5.9700003
 6.0000005

```

But your solution is much simpler and does not require an extra package…
