y=[1 for i=1:3, j=1:3]
yy=hcat(y[:,1:2],[y[:,j] for j=2:3])
ERROR: mismatch in dimension 1
in cat_t at abstractarray.jl:680
in hcat at abstractarray.jl:719
in anonymous at no file
julia> typeof(y[:,1:2])
Array{Int64,2}
julia> typeof([y[:,j] for j=2:3])
Array{Any,1}
hcat(y[:,1:2],Array{Int64,1}[y[:,j] for j=2:3])
but it still doesn't work.
Alternatively, is there any other way to prepend/append/insert a column/row to the matrix y?
Maybe this is what you want
[y[:,1:2] hcat([y[:,j] for j=2:3]...)]
Maybe also add it to the docs for hcat, where I use it all the time??
Ethan
In[1]: f[a, Sequence[b, c], d]
Out[1]: f[a, b, c, d]
function foo1(x,y,z,w)
sin(x+y+z+w)
end
fin = [
3,
4,
5,
6
]
foo1(fin...)
It also works for keyword args
function foo2(;x = 1, y = 2, z = 3, w = 4)
sin(x+y+z+w)
end
fin = [
:x => 3,
:y => 4,
:w => 5,
:z =>6
]
foo2(;fin...)
Cool, right?