Vector to Matrix


#1

How can I convert Vector in Matrix. I have a vector and I can’t fill the matrix. Anybody can help me?


#2

What have you tried so far? Could you give some examples of inputs and desired output?


#3

julia> A=rand(4)
4-element Array{Float64,1}:
0.7826820239542336
0.4314383298572817
0.5367947287158099
0.7861244289613578

julia> B=reshape(A,length(A),1)
4×1 Array{Float64,2}:
0.7826820239542336
0.4314383298572817
0.5367947287158099
0.7861244289613578


#4

Even easier, you can do

B = reshape(A, :, 1)

#5

yes