# Create a matrix with given dimension

**URL:** <https://discourse.julialang.org/t/create-a-matrix-with-given-dimension/98066>\
**Category:** General Usage\
**Tags:** indexing, matrices, offsetarrays\
**Created:** [April 28, 2023, 10:42pm UTC](https://discourse.julialang.org/t/create-a-matrix-with-given-dimension/98066 "2023-04-28T22:42:17Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![angeloaliano1](https://avatars.discourse-cdn.com/v4/letter/a/7ea924/32.png) [@angeloaliano1](https://discourse.julialang.org/u/angeloaliano1)\
**Post date:** [April 28, 2023, 10:42pm UTC](https://discourse.julialang.org/t/create-a-matrix-with-given-dimension/98066/1 "2023-04-28T22:42:17Z")

</div>

Dear all,  
I need to creeate a null three-dimensional matrix d = d[s,l,t] where s = [2,3,4,5], l=[12,13,14,15,16] and t=1:12, e.g, I don’t need for example of positions [1,1,1], [1,2,1], etc, but only in the ranges of the given vectors.  
Anyone can help me please?

---

<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:** [April 29, 2023, 12:04am UTC](https://discourse.julialang.org/t/create-a-matrix-with-given-dimension/98066/2 "2023-04-29T00:04:17Z")

</div>

You can have that with: [GitHub - JuliaArrays/OffsetArrays.jl: Fortran-like arrays with arbitrary, zero or negative starting indices.](https://github.com/JuliaArrays/OffsetArrays.jl)

(but maybe if you explain better what you want there may be a better solution)

---

<div class="post-metadata">

**Author:** ![angeloaliano1](https://avatars.discourse-cdn.com/v4/letter/a/7ea924/32.png) [@angeloaliano1](https://discourse.julialang.org/u/angeloaliano1)\
**Post date:** [April 29, 2023, 12:59am UTC](https://discourse.julialang.org/t/create-a-matrix-with-given-dimension/98066/3 "2023-04-29T00:59:07Z")

</div>

I want a three dimensional matriz where the index of the first dimension is given by: s = [2,4,5,6], the second dimension is only l = 12:16 and the third dimension is the indexes t = 1:12.  
Then, I want to build the array d = d[s,l,t]
