3
$\begingroup$

I have an csv file that I open with excel. In it 2 columns of numbers. I'd like to import it to mathematica and plot it. How can I do ?

$\endgroup$
  • 3
    $\begingroup$ Mathematica can import CSV files--no need for Excel. Have you search the documentation for "CSV"? $\endgroup$ – Szabolcs Oct 5 '18 at 14:10
5
$\begingroup$

As mentioned in the comment above, the CSV file can be imported programmatically, which has been explained clearly in document of CSV, but I'd like introduce a more user-friendly approach in this answer.

First, copy the data to Mathematica in the following way:

enter image description here

Then plot:

ListPlot@%
$\endgroup$
  • $\begingroup$ @JA: To import data from Excel to Mathematica, you might want to try this: SetDirectory["D:\\mathematicaSNAcode_Tugrul"] where D:\\mathematicaSNAcode_Tugrul is the location of the Excel or CVS files to be imported. Then Import["file name.xls", {"Data", 1}] where Data 1 indicates that the data will be imported from Worksheet 1 in case you have several data worksheets in one Excel file. As Szabolcs indicated, CVS files can be imported in the same way as Excel files. $\endgroup$ – Tugrul Temel Oct 5 '18 at 15:26
  • 1
    $\begingroup$ @Tebernus As to the capture of file name and directory, there exists user-friendly way, too: mathematica.stackexchange.com/a/14741/1871 $\endgroup$ – xzczd Oct 5 '18 at 15:29
  • $\begingroup$ Thanks for the useful link. $\endgroup$ – Tugrul Temel Oct 5 '18 at 18:46

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