Tag Info

New answers tagged

2

For simply saving numbers or lists to file, I personally prefer to use Put/>> and PutAppend/>>> to store data, and ReadList to retrieve it. For instance: (# >>> "file.dat") & /@ {1,2,3}; ReadList["file.dat"] (* {1,2,3} *) (# >>> "file.dat") & /@ {1,2,3,4,5}; ReadList["file.dat"] (* {1,2,3,1,2,3,4,5} *) You could ...


5

Open the file with OpenAppend not OpenWrite. Any Writes will then append to the file not overwrite.


0

A similar problem is being discussed in this thread. I'll copy my method of going around it here, in case someone stumbles on this thread through searches. I have been saving a file wit MatrixPlot (using Save As...-> PDF), and have encountered a similar problem. Turns out, MatrixPlot (and similar) data is being exported as a bitmap, which gets ...


1

Actually, the problem is with Mathematica's export, at least with Version 10. I have been saving a file wit MatrixPlot (using Save As...-> PDF), and have encountered the same problem. Turns out, MatrixPlot (and similar) data is being exported as a bitmap, which gets blurred in Adobe Reader 9 (which I have), even if "Smooth line art" and "Smooth images" is ...


3

These are CellLabels and by default they are autodeleted when Notebook is saved. To preserve them, evaluate the following: SetOptions[EvaluationNotebook[], CellLabelAutoDelete -> False]


1

What you observe is line-wrapping which is turned on in Column with the default setting ItemSize -> Automatic: ItemSize->Automatic line-wraps textual elements at the page width On the same Documentation page we read that ItemSize -> Full allows every item its full width and height So all what you need is to add ItemSize -> Full option ...


1

If you data is labelled "blah.xls" then your input should be Import["blah.xls"] Just make sure the data file is in the correct directory.


1

I am the person who originally hit this problem several years ago. Recently Wolfram got back to us with a fix that works for us. It's a slight variation on Alexey's original answer. Export[stringtouse, DeleteCases[ obj /. {_Opacity, p_Point} :> {PointSize[0], p}, _Opacity, Infinity], opts] I bound this up into a little helper function like this. ...


4

UPDATE It seems that I found a straightforward way to disable rasterization while preserving the original appearance: the key is to add the ChartBaseStyle -> EdgeForm[Directive[GrayLevel[0.356], Opacity[1]]] option. The offending dot bug (demonstrated below in the "Original answer" section) we steel have to fix separately via post-processing /. ...


1

Manipulate[Plot[Sin[a x], {x, -2 Pi, 2 Pi}, PlotLabel -> Row[{"a=", a}]], {a, 0, 5}] For exporting, there are many posts on exporting Manipulate to animations/movies. Please see this for example Export animation of a Manipulate autorun sequence? If the above still does not answer you, then you can follow up. ps. You can always just export like this ...


1

Add ItemSize -> Full in the options of Grid. I tested it on your code and it works, meaning that the line is no longer broken in the exported pdf.


5

Part of export to gif options are here. Options[System`ConvertersDump`exportDataToGIFConverter] Obviously not all. As far as I can see in principle all Export[] and Import[] options are here (Save["stdout", #] & /@ Names["System`ConvertersDump`*"]) As you can see they are hardcoded in a number of different functions. If you look only for export to ...


3

data You need to remove the braces around the individual data elements to obtain a rectangular table. You can do this in a number of ways: dt1 = Join @@@ data; dt2 = Map[Flatten, data, -2]; dt3 = Flatten[data, {3, 1}]; dt4 = data /. {x_?NumericQ} :> x; dt1 == dt2 == dt3 == dt4 (* True *) dt1 Export["test.xls", dt1]


1

Here is a way of getting Mathematica’s 3D graphics into COLLADA format — e.g. for importing into iBooks Author on OS X — whilst preserving colour information. Unfortunately, this involves a manual intermediate step using Blender, but it is the only way that I have found that automatically preserves colour. The trick is to use the fact that Blender can ...


3

Solved. I changed the code to "AnimationRepetitions" -> 0 (instead of 1) and opened the gif in Chrome. It ran just once. My bad! I had not considered trying another way to open the gif. I overtrusted my gif renderer.


2

Put seems to treat the argument as literal and not evaluate it. i.e. it takes the argument filename as the actual filename and not its value. In Mathematica talk, this is called Holding its arguments. Just do this: expression >> Evaluate@filename Should work. Worked for me. Full example: SetDirectory[NotebookDirectory[]]; somenumber = 10; ...


3

Introduction There are a few ways to make such a table: (1) a symbolic way that seems conceptually clear and whose slowness is not prohibitive for a table of at most a few thousand entries; (2) using the table created by NDSolve in solving the equation by integrating its derivative either (a) directly or (b) correcting the errors in it; and (3) making a ...


2

I'll try to address this one step at a time. Since a is assigned a value of 0.022 I shall assume we will be working numerically. Let's plot our function. a = 0.022; expr = (1/2) x Sqrt[1 + 4 a^2 x^2] + ArcSinh[2 a x]/(4 a) Plot[expr, {x, -1*^5, 1*^5}] 1/2 x Sqrt[1 + 0.001936 x^2] + 11.3636 ArcSinh[0.044 x] There appear to be no complications so ...


2

OpenAppend itself does not cause newlines to be added. Only the export/write functions do. If you use WriteString, it won't add newlines. For example, s = OpenAppend["app.txt"] Do[WriteString[s, "a"], {5}] Close[s] results in a file containing aaaaa. You can include tabs using "\t".


0

If the lists are all the same length Transpose[Flatten /@ {a, b, c}] But beware that for ragged lists (i.e., those with sub-lists that are not all the same length) Transpose will not work and you have to use Flatten again. a = {{0}, {1}, {{2}}, {3}}; b = {{4}, {5}, {6}}; c = {7, 8, 9}; Flatten[Flatten /@ {a, b, c}, {2}] Transpose::nmtx: The first ...


1

The lists "a" and "b" are nested lists. With the Flatten option, the nested lists my be flattened and the nesting removed. The answer is, as posted from Öskå, to use the Flatten[]-command before the Transpose[]-command is executed.


0

This only exports output cells, but does work. SetOptions[EvaluationNotebook[], NotebookEventActions -> { {"MenuCommand", "Save"} :> Module[{loc, nb, new = FileNameJoin@Append[ Drop[FileNameSplit@NotebookFileName[], -1], FileBaseName@FileNameTake[NotebookFileName[]] <> ".m" ] }, ...


1

I contacted Wolfram Support, who replied: Thanks for your email. We actually changed the implementation of the option "OperatorSubstitution" in Mathematica 10, and now it's a global option. What happens is that the default FormatType used in graphics is "TraditionalForm", and this style has the default setting of "OperatorSubstitution" to True. To ...



Top 50 recent answers are included