Hi, I am looking to write output of a function for different runs to one CSV file. Using the DelimitedFiles package, I can write results to separate CSV files for each run. However, I want to write results from all runs to one CSV file either in separate rows or separate columns.
As an example, I have given some code below. This will create separate CSV file for each run.
To write all results to one CSV file I use CSV.write("TestCSVPack.csv", DataFrame(result))
but I get the following error message
ArgumentError: βBase.Generator{UnitRange{Int64},var"#13#14"{Array{Int64,1}}}β iterates βInt64β values, which doesnβt satisfy the Tables.jl AbstractRow
interface
using CSV, DataFrames, DelimitedFiles
function Addition(x,y,i)
return x[:,i]+y[:,i]
end
x = [1 2 3; 6 8 9]
y = [1 3 1; 10 12 5]
for i = 1:size(x,2)
result = Addition(x,y,i)
# use DelimitedFiles to create a separate CSV file for each run
writedlm( "TestDelimited$i.csv", result)
# use CSV package to create a CSV file for all results. The following line will give an error
CSV.write("TestCSVPack.csv", DataFrame(result))
end
Is there a simple way to fix it, either using the CSV package or another package capable of writing CSV files?