Hot answers tagged

8

You can simply increase the display duration for the last frame. Export["test.GIF", frames, "Interlaced" -> True, "DisplayDurations" -> ReplacePart[Table[0.1, Length[frames]], -1 -> 1.0], "AnimationRepetitions" -> ∞] Citing the GIF documentation: "DisplayDurations"->{d1, d2, ...} specifies the display durations for each frame in ...


8

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

How about: Export[ StringDrop[path, -2] <> "txt", StringRiffle[ NotebookImport[path, "Input" -> "InputText"], "\n" ] ]


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, ...


4

Export["file.txt", list, "List"] and Export["file.txt", StringRiffle[list, "\n"], "Text"] both give a text file like hello world other line


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 ...


3

You can export as a MATLAB .mat file if your array has less than 4 dimensions, rand = RandomReal[1, {1000, 3, 3}]; Dimensions@rand rand[[454, 1, 2]] Export["random.mat", rand]; (* {1000, 3, 3} *) (* 0.786307 *) When you import it again, you have the same dimensions and the elements are the same rand2 = Import["random.mat"]; Dimensions@rand2 rand2[[454, ...


3

You can write your own converter like so: hue2HSB[color : Hue[h_, s_, b_]] := {360. h, 100. s, 100. b} then Hue[0.55, 0.73, 0.82] The next step would be to export the conversion, but since you don't indicate how you plan to do that, I can't say anything more.


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

According to this MathGroup post the function SpaceForm was documented only via Information (i.e. the SpaceForm::usage Message) even in Mathematica 3.0. With current version 10.4.1 the situation is still the same: ? SpaceForm SpaceForm[n] prints as n spaces. So you shouldn't worry: this function is in the current situation right from the start, ...


2

f = OpenWrite["test.txt"]; nsp[n_] := OutputForm[StringJoin[ConstantArray[" ", n]]] Write[f, 1, nsp[3], 2, nsp[1], 3]; Close[f] FilePrint["test.txt"] 1 2 3


2

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


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]]


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 ...


2

You're probably better off using something like Table than an explicit For or Do loop (I believe this is often the case in MMA). e.g: Table[{ beta, alpha, Y4, xx, ms, If[ 0.8 <= Ytt[beta, alpha, Y4] < 1.2, fsigma[beta, alpha, Y4, xx, ms] , 0]}, {beta, ArcTan[0.9], ArcTan[2.], 0.1}, {alpha, ArcTan[0.1], ArcTan[0.3], 0.1}, {Y4, -1, -5, ...


2

What you want, I think, is the cell option ShowCellLabel -> False. You can edit the stylesheet to add the option to the styles "Input" and "Output" in the "Printout" environment. Or you can add them to a notebook, assuming it has the default style definitions, as follows: SetOptions[EvaluationNotebook[], StyleDefinitions -> ...


2

Evaluate this and then save as another nb, open the new nb file, and then save as PDF SetOptions[InputNotebook[], CellLabelAutoDelete -> True];


1

You can generate a table from a loop using Reap and Sow results = Reap[ Do[ If[0.8 < Ytt[beta, alpha, Y4] < 1.2, Sow[{beta, alpha, Y4, xx, ms, fsigma[beta, alpha, Y4, xx, ms]}] ], {beta, ArcTan[0.9], ArcTan[2.], 0.1}, {alpha, ArcTan[0.1], ArcTan[0.3], 0.1}, {Y4, -1, -5, -1}, {xx, -7, 7, 1}, ...


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

Use the Paste Snapshot command from the menu of Manipulate for getting a static DynamicModule code of what you have created: For Exporting you can simply paste the code obtained via the Paste Snapshot command instead of <code> into the expression Export["fig.eps", <code>] (in another Notebook) and evaluated it. With Mathematica 10.4.1 I ...


1

If you don't want to import the graph into some other application, but simply save it for later use, I've found that just saving the graph in .m format preserves everything just fine: Export["graph.m", graph] This is the only approach I've found that preserves property lists, labels, everything.



Only top voted, non community-wiki answers of a minimum length are eligible