# Tag Info

1

This creates some random sample data lists lists = RandomInteger[{0, 9}, {3, 3, 3}]; n = 0; Map[Export[n=n+1;"list"<>ToString[n]<>".txt",#,"Table","FieldSeparators"->" "]&, lists] exports three files list1.txt, list2.txt and list3.txt

1

I think MapIndexed would help you here. Try something like the following: MapIndexed[ Export["list" <> ToString[First@#2] <> ".txt", #1, "Table", "FieldSeparators" -> " "] &, yourmultilist ]

4

I agree on two counts: X3D is a logical export format, but Mathematica's X3D support is, at best, limited. Fortunately, the correspondence between Mathematica's GraphicsComplex and X3D is close enough that it is quite easy to roll your own exporter. To do so, let's begin with your own plot. We'll then extract out the primitives and directives that are ...

2

ClearAll[foo] foo = RawBoxes[Replace[ToBoxes@#, InterpretationBox[a_, b_, c___] :> With[{aa = StringReplace[a, { "Sqrt" -> "sqrt", "Power(E," -> "exp(", "Power" -> "pow"}]}, aa], {0, Infinity}]] &; foo@CForm[D[f, M]]

7

To whom it may concern, a workaround: path = FileNameJoin[{$HomeDirectory, "Desktop", "testWorking.nb"}]; nb = Notebook[{}, Saveable -> False, NotebookEventActions -> {{"MenuCommand", "Save"} :> {}} (*the fix*) ]; Export[path, nb, "NB"] 5 There are two issues here: How to write a string that contains a quotation within it, when the quotation mark is what signifies to the system when a string begins and ends. How to export strings with special characters, and have them written in their escaped form: \[Alpha] and not α For the first, you need to construct the string using \" to begin and ... 5 You can also use WriteLine. Update. I added RunnyKine's solution for completeness. Little benchmark: list = ToString /@ RandomReal[{0, 1}, 1000000]; writeList[name_, list_] := Module[{file}, file = OpenWrite[name]; WriteLine[file, #] & /@ list; Close[file] ]; writeList2[name_, list_] := Module[{file}, file = OpenWrite[name, ... 2 This ListA = { {{n1, p1, a1}, {n1, p2, a2}, {n1, p3, a3}, {n1, p4, a4}}, {{n2, p1, b1}, {n2, p2, b2}, {n2, p3, b3}, {n2, p4, b4}}, {{n3, p1, c1}, {n3, p2, c2}, {n3, p3, c3}, {n3, p4, c4}}}; Export["MathematicaData.CSV", Transpose[Map[Last, ListA, {2}]]] gives this a1,b1,c1,f1 a2,b2,c2,f2 a3,b3,c3,f3 a4,b4,c4,f4 in your csv file. Note you are ... 2 Update Export["filename.csv", ArrayFlatten[{{0, {list[[1, All, 2]]}}, {List /@ list[[All, 1, 1]], list[[All, All, 3]]}}]] OP I'm assuming all the ns and ps are integers. In that case, do Export["filename.csv", SparseArray[{#1, #2} -> #3 & @@@ Flatten[list, 1]]] This works for the ns and ps in any order. If they are actually in the correct ... 4 Export["file.txt", list, "List"] and Export["file.txt", StringRiffle[list, "\n"], "Text"] both give a text file like hello world other line 5 How about: Export[ StringDrop[path, -2] <> "txt", StringRiffle[ NotebookImport[path, "Input" -> "InputText"], "\n" ] ] 3 The .NB files with implementations of the FrontEnd export options Dialogs are located in the folder FileNameJoin[{$InstallationDirectory, "SystemFiles", "FrontEnd", "SystemResources"}] For example, the "PDF Options" Dialog is in the file "ExportPDF.nb". You can open it with a text editor and inspect the implementation. From the internals of the ...

3

Convert the string to a list of integers using ToCharacterCode, and then convert back using FromCharacterCode. testvalsnodvar = {"VOL_FRACTION01"}; Export["test.nc", {"vals_nod_var" -> ToCharacterCode@testvalsnodvar}, "NetCDF"] (* "test.nc" *) Import[ "test.nc", {"Datasets", "vals_nod_var"}] // FromCharacterCode (* {"VOL_FRACTION01"} *)

0

I would use: Export[ "file.txt", Map[FortranForm, data, {2}], "Table", "FieldSeparators" -> " " ] (* File contents: 0 7.38905609893065 5 0.049787068367863944 10 0.00033546262790251185 15 2.2603294069810542e-6 20 1.522997974471263e-8 25 1.026187963170189e-10 30 6.914400106940203e-13 35 ...

4

On MMA 10.3 on OSX 10.10.5 I get the same behaviour as @chuy - blunt on the front end and both export formats. I think the implementation is kind of buggy as one might expect the option JoinForm -> "Miter" to solve the problem, however it changes nothing. However, using the additional option JoinForm -> {"Miter",d} does create the desired behaviour ...

2

I felt like it is something very fundamental for working with UI developement in MMA so I asked WRI Support to help me. It took a while but I received a very good answer, which is to suspend DynamicUpdating when Export takes place. [...] For the effect you want, turn off the global DynamicUpdating option for the fronend just before the call to ...

0

I have know the answer. Add one line at the beginning. SetOptions[\$FrontEndSession, PrintingStyleEnvironment -> "Working"];

1

Hope it's not too late... Suppose you want to dump new data (called here "datanew" and generated somehow) into a new sheet of an existing Excel file named "oldfile.xlsx" containing (in sheet 1) data ("dataold"). What I do is: SetDirectory[NotebookDirectory[]] dataold=Import["oldfile.xlsx"] Export["oldfile.xlsx",{dataold,datanew}] What you are doing is ...

0

plot = ListLinePlot[{Thread[{{0, 360, 720}, {0, 10, 20}}]}, Frame -> True, RotateLabel -> False, FrameLabel -> {{FractionBox["\[CapitalPsi]", "R"], ""}, {FractionBox["\[CapitalPsi]", "R"], ""}}] // DisplayForm fileNameSave = SystemDialogInput["FileSave", "testplot.pdf", WindowTitle -> "Save plot ..."]; ...

1

As pointed out by Ivan Sterling, you cannot simply restrict the PlotRange, as this will not be respected when exporting to "STL". Take Louis's example, ParametricPlot3D[{(2 + Cos[v]) Cos[u], (2 + Cos[v]) Sin[u], Sin[v]}, {u, 0, 2 Pi}, {v, 0, 2 Pi}, PlotRange -> {{0, π}, {0, π}, All}] Export["test.stl", %] // Import One method to make sure ...

0

Works as intended on 10.0 for Mac OS X x86 (64-bit) (December 4, 2014), see also STL (.stl) pp1 = ParametricPlot3D[{(2 + Cos[v]) Cos[u], (2 + Cos[v]) Sin[u], Sin[v]}, {u, 0, 2 Pi}, {v, 0, 2 Pi}] Export["MathematicaParametricSurface.stl", pp1] pp1 = ParametricPlot3D[{(2 + Cos[v]) Cos[u], (2 + Cos[v]) Sin[u], Sin[v]}, {u, 0, 1 Pi}, {v, 0, 1 Pi}] ...

1

ClearAll["Global*"] SetDirectory@NotebookDirectory[] /Users/xxxxxx/Desktop/yxc points = Table[{x, Sin[x]}, {x, Range[0, 2 \[Pi], .01]}]; ListLinePlot[points] Export["Export_Values_1.dat", points] "Export_Values_1.dat" myTable = Table[{r, f3}, {r, 0, 16, 0.1}] ...

2

The output variable lives on the main kernel. This variable is special, it represents an open file. It cannot be used on the parallel kernels if the file was opened on the main kernel. Is it still possible to write to the same file in parallel from multiple different kernels? Yes, but to do it robustly you must use an advanced parallel programming ...

0

I finally create a rasterized eps file with sufficent quality for my needs without losing the ticks. Maybe can be helpful even for other file formats outputs. Try this double rasterization, where you can increase the ImageResolution value, but I do not recomend to increase the RasterSize beyond 515 or the ticks will disappear: myPlot Rasterize[%, ...

0

This may not be the most elegant solution but I have run into a similar problem. You can save a file on the google drive, lets say its G://newTextFile.txt list = {"C", "D", "E", "F", "G", "H", "I"}; drive = Table[FileExistsQ[i <> ":\\newTextFile.txt"], {i,list}]; number = Flatten@Position[drive, True]; driveletter = ToString@list[[number[[1]]]]; ...

1

Needs["DifferentialEquationsInterpolatingFunctionAnatomy`"]; iii = sol[[1, 14, 0]]; coords = InterpolatingFunctionCoordinates[iii]; valus = InterpolatingFunctionValuesOnGrid[iii];

Top 50 recent answers are included