How can I convert Vector in Matrix. I have a vector and I can’t fill the matrix. Anybody can help me?
1 Like
What have you tried so far? Could you give some examples of inputs and desired output?
2 Likes
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
1 Like
Even easier, you can do
B = reshape(A, :, 1)
2 Likes
yes