TL;DR, answer: to get a 2x1 Array/Matrix transpose a 1x2 matrix, for example: [2 4]'
A more general solution that also works for complex numbers in Julia V0.7- would be transpose([2 4])
Yes, that can be done, but it requires multiple statements. But why should the simplest case require the most work? [1 2; 3 4] gives me a 2x2 matrix. [1 2] gives me a 1x2 matrix. Why doesn’t there seem to be a simple way to create a 2x1 matrix? It turns out that [1;2] is the same as [1,2]. One would think/hope/expect that [1;2] would result in a 2x1 matrix, but it doesn’t.
You didn’t specify that you wanted specific values in your matrix, so I didn’t provide you with that. hcat(1,2)' will do what you want (if you want 1 and 2 as your elements. Substitute as appropriate.)
The problem with hcat(1,2)' is that its type is Adjoint{Int64,Array{Int64,2}}, which is correct if you do not use complex numbers but it is simpler to write hvcat(1, 1, 2) I guess to get 2×1 Array{Int64,2} directly.