1
$\begingroup$

My goal is to export a list of numbers into a file, with a comma between each value. Executing the following commands seems to produce a file with a new line between each entry.

v = {1.1, 2.2, 3.3}; SetDirectory@NotebookDirectory[]; Export["v.csv", v, "csv"]; 

When I open the file with notepad, what I see is
1.1
2.2
3.3

What I would like to see is comma separated values, like the following:
1.1, 2.2, 3.3

Recommendations? Thanks.

$\endgroup$

1 Answer 1

4
$\begingroup$

Because your expression v is a vector, it's being interpreted as one line per number.

The following gives your desired result.

Export["v.csv", {v}, "csv"] 
$\endgroup$

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.