Tag Info

Hot answers tagged

12

Your basic requirement is met with: safeExport[file_String, args___] := If[ ! FileExistsQ[file] || ChoiceDialog["File already exists. Overwrite?"], Export[file, args], $Failed ] What you describe as "attributes" (e.g. PlotRange -> All) are known as Options or named optional arguments. (See Attributes for a description of what that ...


4

This is probably not the best idea, but there is a post by Szabolcs that describes some undocumented features of record sound. You can string these together to play the sound, record it back, then save to a file. First, here is a shortened version of your rep function, followed by the "start record", then the call to rep. rep[extra___String] := Speak["Go! " ...


3

As confirmed by WRI, it is a bug, which is specific to Linux and which was introduced in version 10.0.2. No workaround known yet except for two possible recommendations, especially when it comes to plot labels: Avoid using commas or other short symbols like ":", ";" or maybe even "|". Try renaming your variables so that string sequences before the short ...


2

Not entirely straightforward, but as it turns out you can use MeshCells together with DiscretizeGraphics: MeshPrimitives[DiscretizeGraphics[Pyramid[]], 2] (*{Polygon[{{-1., -1., 0.}, {1., -1., 0.}, {0., 0., 1.}}], Polygon[{{-1., -1., 0.}, {0., 0., 1.}, {-1., 1., 0.}}], Polygon[{{1., -1., 0.}, {1., 1., 0.}, {0., 0., 1.}}], Polygon[{{1., 1., 0.}, {-1., ...


2

If spy and efa have the same length, you can use Transpose: Export["data.xls", Transpose[Join @@ Transpose /@ {spy, efa}]] Update: If spy and efa have different lengths, you can use PadRight before the outermost Transpose: d1 = FinancialData["SPY", "Jan.1,2012"]; d2 = FinancialData["EFA", "Jan.1,2012"]; spyb = Prepend[d1[[;; 10]], {, "SPY"}]; efab = ...


2

pl = Table[ Plot3D[fun[t, x, y], {x, -5, 5}, {y, -5, 5}, PlotRange -> All, PlotLabel -> Style["Time = " <> ToString[t], Bold]], {t, 0, 4, 1}]; Export["time.gif", pl, "DisplayDurations" -> 1]


2

I figured it out. Export["~/Desktop/test.txt", {{2334252, 1}, {2, 235211234}}, "Table", "FieldSeparators"->" ", Alignment->Left] Instead of Left you can also use Center/Right. The options for Export with different formats aren't very easy to find in the documentation!


2

Try this: names = FileNames["*.txt"]; Export[StringInsert[#, "_output", -5], Sort /@ Import[#, "Table"][[2 ;;, 2 ;;]], "TSV"] & /@ names


2

Use Table, not For: output = Table[ {p, q, x} /. FindRoot[{f1[p, q] - 0.03 == 0, f2[p, q] - 0.0234 == 0}, {{p, 1}, {q, 2}}], {x, 0, 359} ] Look in $ExportFormats to find the format you want. Export["output.csv", output]


1

No "real" answer, but a deeper analysis into the behavior you experienced: file = "original.m"; fileEnc = "enc.m"; (* alphabet for password: [0-9a-zA-Z] *) alphabet=Sort[CharacterRange @@@ {{"a", "z"}, {"A", "Z"}, {"0", "9"}}//Flatten, ToCharacterCode@#1 < ToCharacterCode@#2&]; (* checking and recording success of decryption together ...


1

Seems to export well (v10.0.2 OSX) this way : plot = Plot[x, {x, -1, 1}, Frame -> True, FrameLabel -> {"x", Rasterize[Style[OverBar[Pane@x], 14, FontFamily -> "Helvetica"], RasterSize -> 200]}]


1

ArrayPlot is not designed for 1:1 mapping of array values to pixels, in fact in typical usage (small array) ArrayPlot generates a raster that is much larger than the input array dimensions. You may get what you want using the PixelConstrained option: ArrayPlot[ data , PixelConstrained -> 1, Frame -> False] ImageDimensions@% == ...


1

You have a ill-formed For-loop. Try For[i = 1, i <= 3, i++, Export["OLEDmovie" <> ToString[i] <> ".bmp", movie[[i]]]] or Do[Export["OLEDmovie" <> ToString[i] <> ".bmp", movie[[i]]], {i, 1, 3}] Both of these worked for me.


1

Obtaining the computed function values on the grid is accomplished with Needs["DifferentialEquations`InterpolatingFunctionAnatomy`"] datau=InterpolatingFunctionValuesOnGrid[solu] datav=InterpolatingFunctionValuesOnGrid[solv] dataw=InterpolatingFunctionValuesOnGrid[solw] where solu, solv, solw are the InterpolatingFunctions produced by NDSolve. If you ...


1

Export has an optional third argument which allows to specify the export format independent of the file extension. In your case, calling Export["file.dat", data, "Package"]; should work fine. Analogously, Import has an optional second argument for the same purpose. Load your file with data2 = Import["file.dat", "Package"]; Alternatives to "Package" ...



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