Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

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.

share|improve this question

1 Answer 1

up vote 4 down vote accepted

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"]
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.