# The solution of JuMP model cannot splice horizontally

**URL:** <https://discourse.julialang.org/t/the-solution-of-jump-model-cannot-splice-horizontally/96511>\
**Category:** Optimization (Mathematical)\
**Tags:** question, jump\
**Created:** [March 23, 2023, 2:25pm UTC](https://discourse.julialang.org/t/the-solution-of-jump-model-cannot-splice-horizontally/96511 "2023-03-23T14:25:10Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![kevinqiao](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kevinqiao/32/44492_2.png) [@kevinqiao](https://discourse.julialang.org/u/kevinqiao)\
**Post date:** [March 23, 2023, 2:25pm UTC](https://discourse.julialang.org/t/the-solution-of-jump-model-cannot-splice-horizontally/96511/1 "2023-03-23T14:25:10Z")

</div>

I encountered an interesting question, I defined a sub-function (it’s a model) with a variable vector of `9×1` dimension, and the variables are as follows

```julia
@variable(model, varFlow[1:9], Bin)

```

The problem can be solved, and I returned the solution by

```julia
solFlow = value.(varFlow)   
return solFlow

```

While I want to concatenate `solFlow` with another `9×1` dimension vector to formulate a `9×2` dimension matrix as follows

```julia
NewFlow = theFunc() # return the solFlow
hcat(LastFlow, NewFlow)

```

However, the `LastFlow` is not changed (NewFlow is not concatenated horizontally), so why? I’m confused, because Matlab can do this, while Julia cannot?

Furthermore, I tried `push!()` function, while it gives me the type of the parameter is `Vector{Any} with 1 element`, and it cannot be further executed as I want, the codes are like

```julia
AllFlow = []
push!(AllFlow, NewFlow) # Vector{Any} with 1 elements

```

---

<div class="post-metadata">

**Author:** ![odow](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/odow/32/28685_2.png) [@odow](https://discourse.julialang.org/u/odow)\
**Post date:** [March 23, 2023, 7:07pm UTC](https://discourse.julialang.org/t/the-solution-of-jump-model-cannot-splice-horizontally/96511/2 "2023-03-23T19:07:07Z")

</div>

> [@kevinqiao](#):
>
> `hcat(LastFlow, NewFlow)`

You need `LastFlow = hcat(LastFlow, NewFlow)`. `hcat` isn’t in-place.
