How to export data from a for loop into a file as a table

Hi,

I am trying to create a table with two columns made from output of mathematica. I have a for loop that looks like this:

For[t = 1, t < 800, t = t + 50, Print]

as well as another similar for loop that creates the same amount of data. I’ve tried exporting just one of the two columns using:

Export[“test.dat”, For[t = 1, t < 800, t = t + 50, Print], “Table”]

but when I try importing “test.dat” it comes up blank (just a {} ). What commands can I use to simply export the results of two (or any number for that matter) for loops as columns in a text file.

Thanks

You can do this, for example:

Export["test.dat", Table[t, {t, 1, 800, 50}], "Table"]

Or a table with two columns:

Export["test.dat", Table[{t, t^2}, {t, 1, 800, 50}], "Table"]

Or a 20x20 matrix:

Export["test.dat", Table[i+j, {i, 20}, {j, 20}], "Table"]