# Tuple to array

**URL:** <https://discourse.julialang.org/t/tuple-to-array/84944>\
**Category:** General Usage\
**Tags:** array, type, tuple\
**Created:** [July 28, 2022, 10:12pm UTC](https://discourse.julialang.org/t/tuple-to-array/84944 "2022-07-28T22:12:16Z")\
**Posts on this page:** 4\
**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 28, 2022, 10:12pm UTC](https://discourse.julialang.org/t/tuple-to-array/84944/1 "2022-07-28T22:12:16Z")

</div>

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

output is one element tuple vector. I can’t access the elements of that output.  
so, how to convert output to a 3x1 matrix.  
Thank You

---

<div class="post-metadata">

**Author:** ![jling](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jling/32/212909_2.png) [@jling](https://discourse.julialang.org/u/jling)\
**Post date:** [July 28, 2022, 10:28pm UTC](https://discourse.julialang.org/t/tuple-to-array/84944/2 "2022-07-28T22:28:30Z")

</div>

```julia
only(s)

```

should give you a tuple, why do you need to convert it to a matrix?

---

<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 29, 2022, 5:05am UTC](https://discourse.julialang.org/t/tuple-to-array/84944/4 "2022-07-29T05:05:25Z")

</div>

```julia

[(1,2,3)...;;]'
#or
hcat([(1,2,3)...])

```

---

<div class="post-metadata">

**Author:** ![mikmoore](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mikmoore/32/31109_2.png) [@mikmoore](https://discourse.julialang.org/u/mikmoore)\
**Post date:** [July 29, 2022, 2:29pm UTC](https://discourse.julialang.org/t/tuple-to-array/84944/5 "2022-07-29T14:29:11Z")

</div>

`reduce(vcat,only(s))` or `vcat(only(s)...)` will convert it to a 3-vector, which should be compatible with a 3x1 matrix almost everywhere unless you have typed some functions too strictly. You can apply an additional `reshape(thevector,3,1)` if you insist on it being a matrix rather than vector.
