Tag Info

New answers tagged

2

So the solution would be (thanks to Pickett) DateString[#, {"Year", "-", "Month", "-", "Day", " ", "Hour", ":", "Minute", ":", "Second"}]&/@dates Once the transformation done, export the thing !


3

In this case, it is advisable to use the Export command: Export["test", data, "Table"] Leads to: Alternative one can use TableSpacing i.e. manipulate space between rows or columns, OutputForm[TableForm[data, TableSpacing -> {0, 0}]] >> "test" this leads to; Edit One can control Accuracy by: data1 = SetAccuracy[RandomReal[{-1, 1}, {3, ...


3

Looks like a bug. Stupid workaround: Export["t:\\test.pdf", ImportString@ExportString[p, "EPS"]] At the very least, there's a good chance that this would output reasonable vector graphics. Or, p = Plot[x, {x, 0, 1}, Frame -> True, FrameLabel -> {x, Sqrt[y]}] The latter is what I usually do, anyway.


2

The format isn't exactly the same, notably there is extra spacing, but this seems to work: ExportString[deployobj, "CDF"]


1

How about this? Grid[Prepend[ Flatten[Table[{a, b, Reverse@NMinimize[{a x + b y, 0.2 x + 0.1 y >= 14, 0.25 x + 0.6 y >= 30, 0.1 x + 0.15 y >= 10, x >= 0, y >= 0}, {x, y}]}, {a, 0, 3, 1}, {b, 0, 3, 1}] /. {ap_, bp_, {{x -> xp_, y -> yp_}, axbyp_}} :> {ap, bp, xp, yp, axbyp}, 1], {"a", "b", "x", ...


3

I'm not sure exactly what you want, but in an effort to demonstrate some possibilities: Join @@ Table[{{a, b}, NMinimize[{a x + b y, 0.2 x + 0.1 y >= 14, 0.25 x + 0.6 y >= 30, 0.1 x + 0.15 y >= 10, x >= 0, y >= 0}, {x, y}][[2]]}, {a, 0, 3, 1}, {b, 0, 3, 1}] // Column Or: Join @@ Table[{{HoldForm[a] -> a, HoldForm[b] -> ...


1

I'm on 10.0 for Mac OS X x86 (64-bit) (June 29, 2014) and and have the following observed: highlighting the Output-Cell and using the Command "Save Selection As" leads to the following result; highlighting the Output and using the Command "Save Selection As" leads to the observed result; Wile CellPrint[ExpressionCell[CharacterRange["a", ...


1

With V10 on OS X, I get Might be a platform issue.


2

The quotes appear because the InputForm does not show them, while the OutputForm does. Programmatically, you can explicitly call OutputForm to avoid this: Export["quotes.png", OutputForm[CharacterRange["a", "z"]]] You can also go into Format > Option inspector… and look for ShowStringCharacters and using Save selection as…:


0

You can use Save: Save["test.m", {f, fsum, gxyz}] For instance: Table[f[i] = i^2, {i, 10}]; fsum = 385; gxyz = "blabla"; Save["test.m", {f, fsum, gxyz}]; FilePrint["test.m"] f[1] = 1 f[2] = 4 f[3] = 9 f[4] = 16 f[5] = 25 f[6] = 36 f[7] = 49 f[8] = 64 f[9] = 81 f[10] = 100 fsum = 385 gxyz = ...


1

Addressing the comment, WriteString can take multiple arguments to write multiple expressions so you can do: WriteString[file, "string" , "\n" ] which may be somewhat more convenient than concatenating the "\n" to the string. If you want to write a list of strings adding linebreaks you can do like this: WriteString[f, Sequence @@ ...


1

It seems that the described method does work in v.10.0.0 if the image is represented as Graphics object. To convert Image to Graphics one can use Show. The reason why Graphics works is that the soft crop explicitly sets new PlotRange what can be seen by applying Options to the cropped image. But in the case of Image the PlotRange option exists only inside ...


4

I think this is a bug rather than a feature. One way to accomplish this that will work in some scenarios without making a copy of the image is to use the crop tool, save the image and then undo the cropping thus restoring the original image.


5

one way: SetDirectory[NotebookDirectory[]]; fileName = "test.txt"; file = OpenWrite[fileName, PageWidth -> Infinity]; WriteString[file,"this is a string which will show up without the quotes"]; Close[file] To open for append and lines: SetDirectory[NotebookDirectory[]]; fileName = "AAA.txt"; file = OpenAppend[fileName, PageWidth -> ...


8

After a rather long debugging session in our chat we could determine the reason of the problem and come up with a workaround. In short, we first tried whether the issue appears for the most basic Graphics[], which it didn't. As it turned out the gray background is introduced by using PlotLegends as in the example above. We went further by comparing ...


3

This has been fixed in version 10. Fonts are now correctly subsetted, even an OpenType font like Calluna, as shown here. The graphic was produced with the following code, and the resulting file size is just 11kb. test = Plot[{Sin[x], Cos[x]}, {x, 0, 5}, BaseStyle -> {FontFamily -> "Calluna Sans", FontSize -> 16}] Export["testcalluna.pdf", ...


2

DXF export is somewhat idiosyncratic (3D only) and slow. For the following I´ve reduced PlotPoints to make casual experimenting less glacial. The general idea is to extract all Line primitives and elevate coordinate tuples to 3D. LG3 = ContourPlot[ 1/2 - Sum[Sinc[(n \[Pi])/2] Cos[n (1 x + 4 ArcTan[y, x])], {n, 1, 200}] == 0.5, {x, -20, 20}, {y, -20, ...


0

I have experienced kernel crashes like that of Mathematica 9.0.1 on OS X in scripts where there is a repeated output to text files during iterations over cycles. Curiously, same scripts run like a charm in Windows, so it is specifically the OS X issue. Diagnosing this problem is hard, since the kernel just crashes, flushes all variables, and the only ...


1

I have successfully exported many 3D Mathematica objects in the .stl format (used for 3D printing). I use Cheetah3D on the Mac (now $69) to work with the object, add axes or colors, then export as a .dae for use in Collada environments like iBooks Author. Maybe Google Sketchup would also work; it has Collada as a native format but not sure what it imports. ...


0

Perhaps tab = {{2, 5}, {5, 7}}; tab2 = List /@ # & /@ tab (* or tab2 = Map[List,tab,{-1}] *) (* {{{2},{5}},{{5},{7}}} *) Export["fileA.xls", tab2]


1

Correct it to be: Export["file.xls",{{2,5},{5,7}}] or more explicitly Export["file.xls",{{2,5},{5,7}},"XLS"] "Table" is a generic Table-Format, suitable for a simple Text-Editor, not specially dedicated to Excel When you leave away the 3rd argument, then the default value is "XLS", and Excel will import it without additional Import-Dialog.


1

Since you mentioned squished axes values when using GraphicsGrid, you can use a combination of ImageSize and BaseStyle--along numerous options to tweak plots and graphics, more info here--within LogLogPlot to achieve the look you want (I haven't experimented with it much but I found font size at 1/20 of image size looks decent). You can also specify the ...


0

If you need to show the points at the arrow tips, you should specify them separately from the specification of the arrows. The points coordinates may be obtained from those of the arrows. Try this: textsize = 16; ah = 0.03; ps1 = 0.5; ps2 = 0.01; lstAr1 = {{{0.0, Sqrt[2]}, {0.35, Sqrt[2]}}, {{-0.1, -Sqrt[2]}, {-0.35, -Sqrt[2]}}, {{2 Pi + 0.1, ...


3

So what you basically have to do is to take the head of the arrow only. I was a bit lazy to rebuild the Polygon myself so I looked for a .m file related to Arrow and found Arrow.m in /usr/local/Wolfram/Mathematica/8.0/AddOns/LegacyPackages/Graphics which contains approximately the following function makehead: makehead[len_, wid_, cent_] := Polygon@{{0, 0}, ...


2

I cannot reproduce this problem on OS X with the current version of Mathematica (9.0.1). However, I think I remember a similar problem existing in some earlier versions of Mathematica, at least on Windows. If my memory is correct, a possible solution was to use one of the PDF printers (Acrobat Distiller, redmon, etc.) to print the notebook to PDF instead ...


2

Just for variety and to deal with ordering issues that some times arise with 1,10,2 by padding left with zeros. This assumes that plots contains list of graphics objects: MapThread[ Export["plot" <> #1 <> ".pdf", #2] &, {IntegerString[#, 10, 3] & /@ Range[Length@plots], plots}] File will be "plot001.pdf","plot002.pdf",etc


2

One way to do this is to Map and Export routine: plots = Table[Plot[Sin[a x], {x, 0, 4 Pi}], {a, 1, 10}] MapIndexed[Export[ToString[First@#2] <> ".png", #1] &, plots] This stores the files with names 1.png, 2.png, etc.


2

plots = Table[Plot[x, {x, -10, 10}], {t, 0, 10, 1}]; names = ToString@StringForm["~/Plot``.pdf", #] & /@ ToString /@ Range@Length@plots; Export[#1, #2] & @@@ Thread@{names, plots} Giving ten different plots exported in PDF.



Top 50 recent answers are included