New answers tagged

2

You are trying to export an Array as a Table, and the system is taking each element at the second level and printing it as you would a number, but in this case it is another list. You just need to flatten each 2 by 2 line in order to export as a "Table" Export["list.dat", Flatten /@ list, "Table"]//Import//Dimensions (* {2726, 4} *)


2

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.


4

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


3

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


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


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.


0

Expanding upon the answers so far you may have a nice format for output on screen (e.g. Dataset) and get your file as you want it. Creating a Dataset data = Table[ (* List elements *) If[ 0.8 <= Ytt[ beta, alpha, Y4 ] < 1.2, (* then *) Association[ "beta" -> beta, "alpha" -> alpha, "Y4" -> ...


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


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

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


0

I absolutely support JasonB's suggestions, especially hdf5 seems a good format for such data when you want to be able to read with other software. But for the case where you only need to write and read with Mathematica, I think the MX format at least needs to be mentioned as well: it is by far the easiest and fastest way to store arbitrary expressions (not ...


0

If you plan to use your data in MMA only you can do a = RandomReal[1, {1000, 3, 3}]; Dimensions[a] a >> testExport.dat b = << testExport.dat; Dimensions[b] a == b


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


0

This might work for you: selected = Select[list, First[#] === p1 || First[#] === p2 &]; MapIndexed[ Export["list_" <> ToString[First@#2] <> ".txt", #1, "Table", "FieldSeparators" -> " "] &, selected[[All, 2]] ] It would be best, however, if you had actual examples of your list and of the polynomials p1 and p2 for us to test our ...


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


2

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



Top 50 recent answers are included