# Any ... but not that much

**URL:** <https://discourse.julialang.org/t/any-but-not-that-much/6300>\
**Category:** General Usage\
**Created:** [October 6, 2017, 10:24pm UTC](https://discourse.julialang.org/t/any-but-not-that-much/6300 "2017-10-06T22:24:18Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![joa-quim](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/joa-quim/32/227_2.png) [@joa-quim](https://discourse.julialang.org/u/joa-quim)\
**Post date:** [October 6, 2017, 10:24pm UTC](https://discourse.julialang.org/t/any-but-not-that-much/6300/1 "2017-10-06T22:24:18Z")

</div>

```julia
a=[]; b=[];

julia> c=[a b]
0×2 Array{Any,2}

julia> c=[1 b]
ERROR: DimensionMismatch("mismatch in dimension 1 (expected 1 got 0)")

```

This highly reduces the usefulness of the `Any`’s. In Matlab we can do

```julia
>> c={1 []};
>> if isempty(c{2}), c{2}=3; end
>> c

c = 

    [1] [3]

```

and I really wished that the same works in Julia

---

<div class="post-metadata">

**Author:** ![mbauman](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mbauman/32/31082_2.png) [@mbauman](https://discourse.julialang.org/u/mbauman)\
**Post date:** [October 6, 2017, 10:31pm UTC](https://discourse.julialang.org/t/any-but-not-that-much/6300/2 "2017-10-06T22:31:21Z")

</div>

When you use the space-delimited syntax in Julia, you are requesting arrays to be concatenated together. If you want the cell-like behavior, you need to use commas:

```julia
julia> c = [a, b]
2-element Array{Array{Any,1},1}:
 Any[]
 Any[]

julia> c = [1, b]
2-element Array{Any,1}:
 1
  Any[]

```

---

<div class="post-metadata">

**Author:** ![joa-quim](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/joa-quim/32/227_2.png) [@joa-quim](https://discourse.julialang.org/u/joa-quim)\
**Post date:** [October 6, 2017, 10:36pm UTC](https://discourse.julialang.org/t/any-but-not-that-much/6300/3 "2017-10-06T22:36:58Z")

</div>

Tricky, but good to know. Thanks.

---

<div class="post-metadata">

**Author:** ![smldis](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/smldis/32/1735_2.png) [@smldis](https://discourse.julialang.org/u/smldis)\
**Post date:** [October 6, 2017, 10:52pm UTC](https://discourse.julialang.org/t/any-but-not-that-much/6300/4 "2017-10-06T22:52:15Z")

</div>

Consider also that you were using a 2 dimensional array instead of a 1 dimensional array (a vector).
