python - Is there an equivalent (or close) to numpy.loadtxt for julia? -
i'm trying convert of python programs on julia , 1 requires take in values in shape of matrix txt file, proceed utilize matrix multiplication , such.
so there improve way input file , load matrix in julia besides iterating on lines or character character?
for example, text file
5 9 10 3
so matrix
[[5,9], [10,3]]
which i'd utilize multiply other matrices, etc.
i got started julia week i'm still doing best comb through library , mit sources. far best thought (assuming there no equivalent numpy.loadtxt) load line line array reshape afterwards, want create efficient possible , seems slow , not clean way of importing it.
try readdlm(). check article more details
julia> file="23 12 13 22 15 61 17 10 1 0 11 12"
you can read , transform array readdlm(iobuffer(file))
, u can forcefulness array's items integers way readdlm(iobuffer(file),int)
julia> readdlm(iobuffer(file)) 3x4 array{float64,2}: 23.0 12.0 13.0 22.0 15.0 61.0 17.0 10.0 1.0 0.0 11.0 12.0
python numpy io julia-lang
No comments:
Post a Comment