I have Mathematica code split into two notebooks. The first part is supposed to run and output a list of numbers into a text file, using Export. The second part uses ReadList to read numbers from the text file, into a list.
I don't like having to convert the list into text and then convert it back to a list. Is there any other way of exporting data which might make it faster for Mathematica to import it again as a list?
Edit:
Suppose the list output from the second notebook has variables and numbers, is storing the result in a text file still ok? For such a case, here is an example of the output list (the way it looks on the text file):
{1}
{75 + 2*Subscript[x, 10] + Subscript[x, 11]}
{-201 - 4*Subscript[x, 10] - 3*Subscript[x, 11] + Subscript[x, 12]}
{157 + 2*Subscript[x, 10] + 3*Subscript[x, 11] - 3*Subscript[x, 12] + Subscript[x, 13]}
{-Subscript[x, 11] + 3*Subscript[x, 12] - 3*Subscript[x, 13] + 10*Subscript[x, 14]}
{-Subscript[x, 12] + 3*Subscript[x, 13] - 12*Subscript[x, 14]}
{-Subscript[x, 13] + 2*Subscript[x, 14]}
If I need to store expressions, which output format is more apt ?
Put(>>) andGet(<<) with a.mfile. – m_goldberg Mar 04 '13 at 22:36Export[filename,Compress@lst]andUncompress@Import[filename]– acl Mar 04 '13 at 23:14DumpSaveis not generically compatible between machines. – Xerxes Mar 05 '13 at 04:42Compressapproach is probably the fastest cross-platform, cross-version solution. – Szabolcs Mar 05 '13 at 18:56Compresscan become almighty slow for large expressions. – Yves Klett Mar 05 '13 at 20:54.m.gzand much faster than.wdx. – Szabolcs Mar 05 '13 at 21:13Compressed files is really fast but I sometimes compress largeGraphicsexpressions and this can take several minutes (compression is very good though). Probably depends on the data, but a plainPutorExportto .m is sometimes much faster. – Yves Klett Mar 05 '13 at 21:45