Any way to write a 2d array literal with single column, 0.6.0?


#1

Hi, I am just looking at 0.6.0 and am having trouble with some old code.
I have many places where I pass a literal, single column, 2d array.

It seems that [ a ; b ], [ [a]; [b] ], vcat([3],[5]) all produce 1D arrays. (not clear why that should be, but that’s another discussion…)

In 0.5, I had an ugly workaround using two transposes: [ a, b ]’’

In 0.6, the above workaround results in a 1D array.

Is there any way to succinctly write a 2D array literal with a single column, or is there only: reshape( [a,b], 2, 1 ) ?


#2

My trial and error is successful with [1 2]'.
Not sure if there is a cleaner way, for sure you could use the constructor.


#3

Related reading: https://github.com/JuliaLang/julia/pull/23790


#4

Thank you both!