# Mapslices failing on n x 0 matrices

**URL:** https://discourse.julialang.org/t/mapslices-failing-on-n-x-0-matrices/9256
**Category:** General Usage
**Tags:** question
**Created:** [February 22, 2018, 3:35pm UTC](https://discourse.julialang.org/t/mapslices-failing-on-n-x-0-matrices/9256 "2018-02-22T15:35:56Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![vvjn](https://avatars.discourse-cdn.com/v4/letter/v/5f9b8f/32.png) [@vvjn](https://discourse.julialang.org/u/vvjn)
#### Post date: [February 22, 2018, 3:35pm UTC](https://discourse.julialang.org/t/mapslices-failing-on-n-x-0-matrices/9256/1 "2018-02-22T15:35:56Z")

</div>

Is this supposed to happen? I tried `mapslices(x->x*2, rand(3,0), 1)` and it errors. `mapslices(x->x*2, rand(3,1), 1)` works as expected.

`map(x->x*2, rand(0))` works, so I would assume mapslices should work on empty matrices.

---

<div class="post-metadata">

### Author: ![Tamas\_Papp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tamas_papp/32/25949_2.png) [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)
#### Post date: [February 22, 2018, 5:42pm UTC](https://discourse.julialang.org/t/mapslices-failing-on-n-x-0-matrices/9256/2 "2018-02-22T17:42:09Z")

</div>

> [@vvjn](#):
>
> so I would assume mapslices should work on empty matrices.

Note that `rand(0)` is an empty `Vector`, not a `Matrix`.

Also, since `mapslices` determines the resulting dimension from the result of function calls, what should it return when there are no slices?

---

<div class="post-metadata">

### Author: ![vvjn](https://avatars.discourse-cdn.com/v4/letter/v/5f9b8f/32.png) [@vvjn](https://discourse.julialang.org/u/vvjn)
#### Post date: [February 22, 2018, 7:14pm UTC](https://discourse.julialang.org/t/mapslices-failing-on-n-x-0-matrices/9256/3 "2018-02-22T19:14:19Z")

</div>

Okay yeah I guess that makes sense.
