I am exporting data from the table "mydata1" in a CSV format into "file1.dat". Below is the mathematica code:

mydata1=TableForm[Flatten[
Table[Table[Table[
                 {xcord, ycord, zcord}, {xcord, 0,50,10}],
                   {ycord,0,50,10}], {zcord, 50, 100, 10}], 2]];

Export["file1.dat",mydata1,"CSV"]

Now my "file1.dat" looks like this:

0,0,50
10,0,50
20,0,50
..
.. and so on

Now I have another set of data from the table "mydata2"(Code given below).I want to able to store the data from this table "mydata2" into same file "file1.dat".But before I do that I need to write a text in the file"file1.dat" for eg"Data below are from mydata2".

Note both data from both tables needed to be exported in CSV format.

mycounter=20
mydata2=TableForm[Flatten[
Table[Table[Table[
                 {++mycounter,xcord, ycord, zcord}, {xcord, 0,50,10}],
                   {ycord,0,50,10}], {zcord, 50, 100, 10}], 2]];

in the end my data file "file1.dat" should look like this

*Data from data from mydata1
0,0,50
10,0,50
20,0,50
... and so on
*Below data from mydata2
21,0,0,50
22,10,0,50
23,20,0,50
... and so on.

If you observe the final data file "file1.dat" should have data from table"mydata2" below the data from"mydata1" and in between there is some text written.

Note: I am willing to export the data with the extension TXT but in CSV format For example:

Export["file1.txt", mydata1, "CSV"]

I have used the "PutAppend" but it dosen't give me the desired results.Either I am not using it properly or perhaps it is not the keyword for my kind of problem.

I have lot of question regarding exporting but I wouldn't ask all of this now since I don't want to confuse you all.

没有正确的解决方案

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top