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
@variable(model, varFlow[1:9], Bin)
The problem can be solved, and I returned the solution by
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
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
AllFlow = []
push!(AllFlow, NewFlow) # Vector{Any} with 1 elements