The easiest way is to use writedlm
, but that won’t give you the exact same formatting:
using DelimitedFiles
p = [1, 2]
q = [3, 4]
writedlm("pqfile.txt", (p, q), " ")
# Output:
# 1 2
# 3 4
If you want more control over the formatting you can write the file manually using the @printf
macro and iterating over the arrays.