# Save data to text file - List_plot(...).save(Path, Name..)?

 0 Hey, Is there a way to save data in list plot as a text file in stead/ in addition to showing it with .show() ? In this way - I want to export the data from my list, say to Excel or Matlab in order to plot it using their tools. I wish the data would be arrange in the text file in a list of values that I could then copy (for example) to the Excel table. Thanking u on advance! asked Jun 25 '12 Anonymous

 1 You can use the Data Menue DATA is an environment variable: path to the attached files of the respective worksheet. L = [0..10] out = file(DATA+'mydata.txt','w') for k in L: out.write(str(k)+'\n') out.close() list_plot(L).save(DATA+'myplot.png')  The files should appear in the list of Data files. posted Jun 25 '12 ndomes 536 ● 7 ● 16 O.K, thanks! - Where do I see the list of data files, and are they in a format that I could export to other program, such as an Excel table, or as a *.png? What is the meaning of the two different 'out's - before and inside the loop? The out.close() is used because of the loop? Erez (Jun 25 '12)
 1 Another option is the use the csv package in python. You can write using this as follows. In the snippet below, info is a list of lists containing data that you want to write to a file. import csv info=[[1,2,3],[4,5,6]] writefile = csv.writer(open(DATA+'myfile.csv', 'w')) for i in range(0,len(info)): writefile.writerow(info[i])  This will result in a .csv file that Excel can read. posted Jun 25 '12 calc314 1820 ● 3 ● 19 ● 51
 0 Thx both! Eventually I tried more or less both ways and it worked, I used the txt file. posted Jun 27 '12 Erez 1 ● 4

[hide preview]