Reputation: 534
I know this is a beginnerquestion but i'm having problems in saving my data into a CSV file for example like in this code:
function mar(x,y)
for i in 1:10
s=x*i+y
end
end
how to save s
and x
and y
i just would like to know the procedure that's all.
Upvotes: 1
Views: 804
Reputation: 13800
You can use the CSV.jl
library, which includes the CSV.write
function. Example:
julia> using CSV
julia> x = rand(10); y = rand(10); s = (1:10).*x .+ y;
julia> CSV.write("out.csv", (s = s, x = x, y = y))
Here I'm constructing a NamedTuple
from s
, x
, and y
, which satisfies the Tables.jl
interface and therefore can be written out to file by CSV.jl
like any other table.
Upvotes: 3