# Reshape a tridimentional matrix

**URL:** <https://discourse.julialang.org/t/reshape-a-tridimentional-matrix/1146>\
**Category:** General Usage\
**Tags:** question\
**Created:** [December 25, 2016, 12:51pm UTC](https://discourse.julialang.org/t/reshape-a-tridimentional-matrix/1146 "2016-12-25T12:51:28Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Naelson\_douglas](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/naelson_douglas/32/1790_2.png) [@Naelson\_douglas](https://discourse.julialang.org/u/Naelson_douglas)\
**Post date:** [December 25, 2016, 12:51pm UTC](https://discourse.julialang.org/t/reshape-a-tridimentional-matrix/1146/1 "2016-12-25T12:51:29Z")

</div>

Hello.

I wrote a code in Julia 4.7 that uses a reshape of a 3D matrix just like this:

> a = ones(2,2)  
> b = ones(2,2)  
> c = ones(2,2)

> d = reshape([[a],[b],[c]], (2,2,3)

The code used to work ( on version 0.4.7 (check it working [here](https://asciinema.org/a/4lfazn9k0gdmwqfsosl4ztkcn))

But on 0.5.0 the reshape has changed and it my code no [longer works](https://asciinema.org/a/elhplbi9otlhwsuhs9d576u9z)

My question is: How can I create my (2,2,3) matrix in 0.5.0 from my (2,2) matrices?

---

<div class="post-metadata">

**Author:** ![yuyichao](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/yuyichao/32/20_2.png) [@yuyichao](https://discourse.julialang.org/u/yuyichao)\
**Post date:** [December 25, 2016, 1:08pm UTC](https://discourse.julialang.org/t/reshape-a-tridimentional-matrix/1146/2 "2016-12-25T13:08:20Z")

</div>

> [@Naelson\_douglas](#):
>
> [[a],[b],[c]]

This is not a tridimentional matrix. Please follow the deprecation warning on 0.4.x.

```julia
julia> d = reshape([[a],[b],[c]], (2,2,3))
WARNING: [a] concatenation is deprecated; use collect(a) instead                  
 in depwarn at ./deprecated.jl:73                                                 
while loading no file, in expression starting on line 0                           
WARNING: [a] concatenation is deprecated; use collect(a) instead                  
 in depwarn at ./deprecated.jl:73                                                 
while loading no file, in expression starting on line 0                           
WARNING: [a] concatenation is deprecated; use collect(a) instead                  
 in depwarn at ./deprecated.jl:73                                                 
while loading no file, in expression starting on line 0                           
WARNING: [a,b,...] concatenation is deprecated; use [a;b;...] instead             
 in depwarn at ./deprecated.jl:73                                                 
while loading no file, in expression starting on line 0                           
2x2x3 Array{Float64,3}:                                                           
[:, :, 1] =                                                                       
 1.0 1.0                                                                         
 1.0 1.0                                                                         
                                                                                  
[:, :, 2] =                                                                       
 1.0 1.0                                                                         
 1.0 1.0                                                                         

[:, :, 3] =
 1.0 1.0
 1.0 1.0

```

```julia
julia> d = reshape([a; b; c], (2,2,3))
2×2×3 Array{Float64,3}:
[:, :, 1] =
 1.0 1.0
 1.0 1.0

[:, :, 2] =
 1.0 1.0
 1.0 1.0

[:, :, 3] =
 1.0 1.0
 1.0 1.0

```
