|
Fuer alle, die noch keine Mathematica 4 besitzen, hier eine kleine Loesung fuer Versionen bis 3. WriteTableForm[file_String, data_List, head:({_String...} | {}):{}] := Module[{str}, str = OpenWrite[file]; WriteString[str, ToString[TableForm[data, TableHeadings->{None, head}, TableSpacing->{0, 2}]]]; Close[str] ] Beispiel: In[1]:= <<WriteTableForm.m In[2]:= A = { {a1,b1,c1,d1}, {a2,b2,c2,d2}, {a3,b3,c3,d3}}; In[3]:= B= Transpose[A]; In[4]:= WriteTableForm["B.txt", B, {"Spalte1", "Spalte2", "Spalte3"}] Out[4]= B.txt In[5]:= !!B.txt Spalte1 Spalte2 Spalte3 a1 a2 a3 b1 b2 b3 c1 c2 c3 d1 d2 d3 Das head kann man weglassen. Z.B. In[5]:= WriteTableForm["B.txt", B] Out[5]= B.txt In[6]:= !!B.txt a1 a2 a3 b1 b2 b3 c1 c2 c3 d1 d2 d3 Gruss Marek Twardochlib >liebe Mathematematica Anwender ! > Ich moechte eine Liste von entstandene Ergebnis von Mathematica in TableForm > als asc oder Text-Datei Speichern. > > ein Beispiel: > > A = { {a1,b1,c1,d1}, {a2,b2,c2,d2}, {a3,b3,c3,d3}}; > B= Transpose[A]; > Print[" Spalte1 ,Spalte2,Spalte3"]; > Print[TableForm[B]];A > > Das Ergebnis sieht so aus : > > Spalte1, Spalt2, Spalte3 > a1 a2 a3 > b1 b2 b3 > c1 c2 c3 > > Jetzt Die Frage : > Wie kann ich mathematica hinweisen mir dieses Ergebnis in form von Tabelle > also TableForm ) als Text oder asc-datei zu speichern so das, wenn ich die > Datei offne es genauso aussieht : > > Spalte1, Spalt2, Spalte3 > a1 a2 a3 > b1 b2 b3 > c1 c2 c3 > > > Mit " >>" bekomme ich das Ergebnis mit " {........}" und ich moechte das > Ergebniss nicht mit "nb" speicher. > Auch mit Save[........], klappt es nicht. |