|
Hallo Hippolyte, ich hatte das gleiche Problem wie Du schon mal vorher. Damals bekam ich ein Mathematica-Package namens Mylist (als Notebook angehaengt und als Package im Text) Durch Einlesen des Package <<mylist.m kannst Du dann nach Deinen Berechnungen einfach eingeben mylist["test",B] und das gewuenschte Ergebnis ist dann in einer Datei namens test gespeichert. Das Package sieht folgendermassen aus: BeginPackage["mylist`"]; mylist::usage="mylist[filename,daten] schreibt eine zweidimensionale\n Matrix in ein File mit Namen filename und entfernt dabei die geschweiften\n Klammern." Begin["mylist`Private`"]; mylist[filename_String,data_List] := Module[{ datei = OpenWrite[filename] }, Map[ ( WriteString[datei, First[#]]; Map[ WriteString[datei,"\t",#]&, Rest[#] ]; WriteString[datei,"\n"] )&, data ]; Close[datei] ]; End[]; EndPackage[]; Indem Du mylist.nb unter Save as Special -> Package abspeicherst, wird die Datei mylist.m erzeugt, falls es sonst irgendwelche Schwierigkeiten gibt. Viel Erfolg CU Marko Bertmer *************************************** Dr. Marko Bertmer RWTH Aachen Lehrstuhl fuer Makromolekulare Chemie Raum 38B-113 Worringer Weg 1 52056 Aachen Tel. (0241) 806423 Fax (0241) 8888185 *************************************** (*********************************************************************** Mathematica-Compatible Notebook This notebook can be used on any computer system with Mathematica 3.0, MathReader 3.0, or any compatible application. The data for the notebook starts with the line of stars above. To get the notebook into a Mathematica-compatible application, do one of the following: * Save the data starting with the line of stars above into a file with a name ending in .nb, then open the file inside the application; * Copy the data starting with the line of stars above to the clipboard, then use the Paste menu command inside the application. Data for notebooks contains only printable 7-bit ASCII and can be sent directly in email or through ftp in text mode. Newlines can be CR, LF or CRLF (Unix, Macintosh or MS-DOS style). NOTE: If you modify the data for this notebook not in a Mathematica- compatible application, you must delete the line below containing the word CacheID, otherwise Mathematica-compatible applications may try to use invalid cache data. For more information on notebooks and Mathematica-compatible applications, contact Wolfram Research: web: http://www.wolfram.com email: info@XXXXXXX.com phone: +1-217-398-0700 (U.S.) Notebook reader applications are available free of charge from Wolfram Research. ***********************************************************************) (*CacheID: 232*) (*NotebookFileLineBreakTest NotebookFileLineBreakTest*) (*NotebookOptionsPosition[ 2395, 62]*) (*NotebookOutlinePosition[ 3260, 94]*) (* CellTagsIndexPosition[ 3216, 90]*) (*WindowFrame->Normal*) Notebook[{ Cell[TextData[ "BeginPackage[\"mylist`\"];\nmylist::usage=\"mylist[filename,daten] schreibt \ eine zweidimensionale\\n\nMatrix in ein File mit Namen filename und entfernt \ dabei die geschweiften\\n\nKlammern.\"\nBegin[\"mylist`Private`\"];\n\n\ mylist[filename_String,data_List] :=\n\tModule[{\n\t\t\tdatei = \ OpenWrite[filename]\n\t\t },\n\t\t Map[\n\t\t\t\t(\n\t\t\t\t \ WriteString[datei, First[#]];\n\t\t\t\t Map[\n\t\t\t\t\t\tWriteString[datei,\ \"\\t\",#]&,\n\t\t\t\t\t\tRest[#]\n\t\t\t\t\t ];\n\t\t\t\t \ WriteString[datei,\"\\n\"]\n\t\t\t\t)&,\n\t\t\t\tdata\n\t\t\t ];\n\t\t\t \ Close[datei]\n\t\t\t ];\nEnd[];\nEndPackage[];"], "Input", PageWidth->Infinity] }, FrontEndVersion->"Microsoft Windows 3.0", ScreenRectangle->{{0, 800}, {0, 544}}, WindowToolbars->{}, CellGrouping->Manual, WindowSize->{512, 452}, WindowMargins->{{50, Automatic}, {Automatic, 15}}, PrivateNotebookOptions->{"ColorPalette"->{RGBColor, -1}}, ShowCellLabel->True, ShowCellTags->False, RenderingOptions->{"ObjectDithering"->True, "RasterDithering"->False} ] (*********************************************************************** Cached data follows. If you edit this Notebook file directly, not using Mathematica, you must remove the line containing CacheID at the top of the file. The cache data will then be recreated when you save this file from within Mathematica. ***********************************************************************) (*CellTagsOutline CellTagsIndex->{} *) (*CellTagsIndex CellTagsIndex->{} *) (*NotebookFileOutline Notebook[{ Cell[1711, 51, 681, 10, 70, "Input"] } ] *) (*********************************************************************** End of Mathematica Notebook file. ***********************************************************************) BeginPackage["mylist`"]; mylist::usage="mylist[filename,daten] schreibt eine zweidimensionale\n Matrix in ein File mit Namen filename und entfernt dabei die geschweiften\n Klammern." Begin["mylist`Private`"]; mylist[filename_String,data_List] := Module[{ datei = OpenWrite[filename] }, Map[ ( WriteString[datei, First[#]]; Map[ WriteString[datei,"\t",#]&, Rest[#] ]; WriteString[datei,"\n"] )&, data ]; Close[datei] ]; End[]; EndPackage[]; |