about the delim parameter, this is what REPL provides
help?> writedlm
search: writedlm
writedlm(f, A, delim='\t'; opts)
Write A (a vector, matrix, or an iterable collection of
iterable rows) as text to f (either a filename string or an
IO stream) using the given delimiter delim (which defaults
to tab, but can be any printable Julia object, typically a
Char or AbstractString).
as far as the operating logic of the two functions writedlm and readdlm is concerned, since I cannot follow / understand the code I try to deduce from tests how it “works” at least in some simple cases.
To this end, I made the following tests
v = [(1, 0.1, [1 , 2 , 3]), (2 , 0.2 , [3 , 4 , 5])]
# content of dlmv file
# 1 0.1 [1, 2, 3]
# 2 0.2 [3, 4, 5]
julia> rv = open("dlmv.csv", "r") do io
readdlm(io)
end
# 2Ă—5 Matrix{Any}:
# 1 0.1 "[1," "2," "3]"
# 2 0.2 "[3," "4," "5]"
v1=[v]
# content of dlmv1 file
# (1, 0.1, [1, 2, 3]) (2, 0.2, [3, 4, 5])
julia> rv1 = open("dlmv1.csv", "r") do io
readdlm(io,',')
end
# 1Ă—9 Matrix{Any}:
# "(1" 0.1 " [1" 2 " 3])\t(2" 0.2 " [3" 4 " 5])"
v2=[v,v]
# content of dlmv2 file
# (1, 0.1, [1, 2, 3]) (2, 0.2, [3, 4, 5])
# (1, 0.1, [1, 2, 3]) (2, 0.2, [3, 4, 5])
julia> open("dlmv2.csv", "r") do io
readdlm(io,',')
end
# 2Ă—9 Matrix{Any}:
# "(1" 0.1 " [1" 2 " 3])\t(2" 0.2 " [3" 4 " 5])"
# "(1" 0.1 " [1" 2 " 3])\t(2" 0.2 " [3" 4 " 5])"
From these tests I deduce that, in the writing phase, the comma at the level of the external square brackets (let’s say level-0, this level) is translated into “new line” and the one at level-1 is translated into a space / tab.
On the other hand, during the reading phase, the comma function as delimiter intervenes at all levels.
In this sense I described the two characteristics of the writedlm functions (which uses info on the vector structure) while for readdlm the content is “flat”