Mathematica 9 is now available
Student Support Forum
-----
Student Support Forum: 'Appending row of data to existing file' topicStudent Support Forum > General > Archives > "Appending row of data to existing file"

Next Comment >Help | Reply To Topic
Author Comment/Response
Chris
06/04/12 10:51am

Hi,
I wrote a program that currently uses a number of conditions to write rows into a table (saved to a variable, say "tabvar") generated within Mathematica. The nature of my analysis will, in the end, generate an extremely large dataset with tens of millions of rows. I am thinking that having Mathematica save this dataset within itself is slowing it down, and I would like to speed it up by saving the data elsewhere in a file. I'm thinking of generating a file, then having Mathematica append each row of data to that file. The problem is that I can't append the data in the format I want it.

For example, if I do this:

Export["file.txt",tabvar,"Table"]

it generates the table just as I need it, in a tab-delimited format without the {{}}. The problem with doing this iteratively is that it must overwrite the file each time, which takes time and might result in the loss of all data if the computer or program were to quit during that process.

If I do this:

OutputForm[TableForm[tabvar]]>>>"file.txt"

it appends the rows just fine, but it is not tab-delimited.

Does anyone know how I can append rows of data in a tab-delimited table format to an existing file?

Thanks!

URL: ,

Subject (listing for 'Appending row of data to existing file')
Author Date Posted
Appending row of data to existing file Chris 06/04/12 10:51am
Re: Appending row of data to existing file Michael 06/05/12 10:45am
Next Comment >Help | Reply To Topic