# How to reinterpret existing array in to a StaticArray

**URL:** <https://discourse.julialang.org/t/how-to-reinterpret-existing-array-in-to-a-staticarray/10492>\
**Category:** General Usage\
**Tags:** question\
**Created:** [April 23, 2018, 3:57pm UTC](https://discourse.julialang.org/t/how-to-reinterpret-existing-array-in-to-a-staticarray/10492 "2018-04-23T15:57:53Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![floswald](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/floswald/32/195_2.png) [@floswald](https://discourse.julialang.org/u/floswald)\
**Post date:** [April 23, 2018, 3:57pm UTC](https://discourse.julialang.org/t/how-to-reinterpret-existing-array-in-to-a-staticarray/10492/1 "2018-04-23T15:57:53Z")

</div>

Continuing the discussion from [Reinterpret 3D array into array of SMatrices](https://discourse.julialang.org/t/reinterpret-3d-array-into-array-of-smatrices/6957):

I asked a similar question before, but the solution doesn’t work any longer. I used to be able to do this but now it throws an error that I don’t understand:

```julia
using StaticArrays
A = rand(2,3,5);
reinterpret(SMatrix{2,3,Float64},A,(5,),2*3)
ERROR: MethodError: no method matching reinterpret(::Type{StaticArrays.SArray{Tuple{2,3},Float64,2,L} where L}, ::Array{Float64,3}, ::Tuple{Int64}, ::Int64)
Closest candidates are:
  reinterpret(::Type{T}, ::Array{S,N} where N, ::Tuple{Vararg{Int64,N}}) where {N, S, T} at array.jl:155
  reinterpret(::Type{T}, ::Array{S,N} where N) where {S, T} at array.jl:148
  reinterpret(::Type{T}, ::Base.ReshapedArray, ::Tuple{Vararg{Int64,N}} where N) where T at reshapedarray.jl:171
  ...

```

any ideas?

thanks!

---

<div class="post-metadata">

**Author:** ![floswald](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/floswald/32/195_2.png) [@floswald](https://discourse.julialang.org/u/floswald)\
**Post date:** [April 23, 2018, 4:15pm UTC](https://discourse.julialang.org/t/how-to-reinterpret-existing-array-in-to-a-staticarray/10492/2 "2018-04-23T16:15:27Z")

</div>

oh i see. this has to be put inside the type declaration now:

```julia
reinterpret(SMatrix{2,3,Float64,6},A,(5,))

5-element Array{StaticArrays.SArray{Tuple{2,3},Float64,2,6},1}:
 [0.00793254 0.304444 0.932803; 0.765576 0.847383 0.391187]
 [0.651666 0.885873 0.648122; 0.146218 0.261972 0.594099]  
 [0.410662 0.523081 0.945088; 0.129933 0.144542 0.227049]  
 [0.975269 0.86898 0.997614; 0.909002 0.329853 0.73141]    
 [0.351473 0.864738 0.769397; 0.79498 0.977108 0.390928]   

```

sorry there was someone replying just now…
