How to add vectors to the columns of some array in Julia?

前端 未结 3 1970
悲哀的现实
悲哀的现实 2021-01-19 06:18

I know that, with package DataFrames, it is possible by doing simply

julia> df = DataFrame();

julia> for i in 1:3
          df[i] = [i, i         


        
3条回答
  •  孤街浪徒
    2021-01-19 06:33

    Loop over the rows of the matrix:

    A = zeros(3,3)
    for i = 1:3
      A[i,:] = [i, i+1, 2i]
    end
    

提交回复
热议问题