Tag Info

New answers tagged

11

One very clean way to do this is via x3dom, which is a javascript framework for deploying the x3d standard. The library is well supported by modern browsers, and the output is an html file with a supporting archive of x3d files. It is generally very clean and fast, and it does not require any external plugins. The library can be called from the x3dom site or ...


5

After a bit of consideration I recommend that you use ParallelSubmit and related functionality, e.g. WaitAll. Please consider this example: job = Array[ParallelSubmit[Pause[1]; If[Random[] > 0.7, Quit[]]; Print[#]] &, 10] This creates a series EvaluationObject tasks to perform. Within each is a 30% chance of failure simulated by If[Random[] ...


1

Windows users can use my MathMF package for this. There's no need to export the frames as images, you just write them directly to a video stream as you create them. It doesn't have the flexibility of third party tools like ffmpeg but it's good for a quick and easy video export without storing all frames in memory. Example code: Needs["MathMF`"] {w, h} = ...


10

The way I typically handle this type of situation is to export the individual images, then have software like FFmpeg handle the conversion to video. FFmpeg in particular is an extremely powerful tool (and is available for Windows, OS X, and most Linux distros). First download the appropriate binary for your system. I placed the ffmpeg binary in the ...


3

Update 2015-05-14 I contacted WRI support and they confirmed that this is a known issue with Export (support case: 3206586). Summary @ChenStatsYu seems to have found an unexplained behavior of the Export function for PDF files that looks like a bug. Detailed results 1) I generated two graphics similar to those in the OP's original question, then ...


0

Plot[{PDF[NormalDistribution[], x], PDF[NormalDistribution[-4, 1], x], PDF[NormalDistribution[2, 1], x]}, {x, -8, 6}, AxesLabel -> {None, None}, Ticks -> {Automatic, None}, Axes -> {True, False}, Background -> None, PlotLegends -> Placed[{"N(0,1)", "N(-4,1)", "N(2,1)"}, {1, .5}]]


1

This is unfortunately not an answer, but an extended comment that outgrew the comment form. In short, this might be a bug in ExportString. I am using Mathematica v. 10.1.0 on Windows 7 - 64 bit. Here's what I tried so far. I tried to export your JSON content to a file, using the same format you proposed. This works just fine. Export["fromExport.json", ...


1

(Updated for clarity) Skimming through Developing an Export Filter is helpful in understanding the process I describe below. First, it is helpful to see what Mathematica is doing when it exports an XYZ file. To figure this out, we can look at the appropriate formatting package: FileNameJoin[{$InstallationDirectory, "SystemFiles", "Formats", "XYZ", ...


2

UPDATE: an export routine written from scratch After clarifications from Zoe, I realize that her problem is not in the export format; not even in the sneaky way that Mathematica tries to outsmart the user by performing hidden unit conversions. The problem is the output number format! I couldn't find a way to convince the Export function to output numbers ...


1

Update: I haven't written any C in a long while, so I forgot its syntax for multidimensional arrays, i.e. array[first][second]! Here is the amended code: ToString[CForm[t[12, 156] + ht u[5, 3]]] StringReplace[%, { "t(" ~~ Shortest[a__] ~~ "," ~~ Shortest[b__] ~~ ")" -> "t[" ~~ a ~~ "][" ~~ b ~~ "]", "u(" ~~ Shortest[a__] ~~ "," ~~ Shortest[b__] ~~ ...


13

Yes, there is! Mathematica creates a LibraryFunction when compiling to C, but puts it in a temporary directory. If you can recover the library, you can load it as often as you like! First let's define the function as in the question: generatef[opt_] := Compile[{}, Module[{j = 0}, Do[j++, {i, 10^8}]; j], CompilationTarget -> opt]; f2 = generatef["C"]; ...


2

I appreciate the solution given by Jens and find it's a nice one. The problem with that solution is that the required font Times-Roman is actually missing from the Type1 Mathematica folder. So I just wanted to share a workaround I found. It's very simple. Open your pdf in Adobe Illustrator, hit OK when proposed to use a substitute font. Go to the ...


0

This seems to work: list = Style @@@ ColorData["Crayola", "ColorRules"]; Export["test.rtf", Cell[BoxData @ ToBoxes @ #, "Output"] & /@ list]


0

The challenge for me was concatenating styled strings. To concatenated the styled text for output, just put a space between them. With that the styles export successfully: Export["test.rtf", Style["Arff", Red] Style["Meow", Blue] ] That made the text is colored correctly when opened with Word on Windows. You can also try: ...


1

Personally, in this case I think Do is acceptable. However, an arguably more elegant way of approaching the task, where you don't need to specify the number of elements in plottable, is with MapIndexed. MapIndexed[Export["Plot" <> ToString @@ #2 <> ".pdf", #1, "PDF"] &, plottable] Unlike Do this returns a list of the outputs of Export, ...


6

Update: Generate a separate legend with the default color scheme and export it: lineleg = LineLegend["DefaultPlotStyle"/. (Method/. Charting`ResolvePlotTheme[Automatic, ListLinePlot]), {"leg1", "leg2", "leg3"}]; Export["plotlegend.pdf",lineleg] To get the default colors associated with various PlotThemes you can use the function ...


7

Using either Swatchlegend, PointLegend, LineLegend, Barlegend you can easily generate a legend like you would get in a plot. SwatchLegend[{Red, Green, Blue}, {"red", "green", "blue"}] PointLegend[{Red, Green, Blue}, {"red", "green", "blue"}] LineLegend[{Red, Green, Blue}, {"red", "green", "blue"}] BarLegend["Rainbow"] Non-default styles are ...


4

You can generate a random signal, if that is indeed what you mean, using a random walk. For example, 1000 samples would look something like this: (* Generate the samples and plot *) samples = Accumulate[RandomReal[{-1, 1}, 1000]]; ListLinePlot[samples] (* And to export them to CSV *) Export["\\path\\to\\file\\randomsamples.csv", samples, "CSV"]; And ...


4

You need to ask yourself a few more questions about what you want. If you want your random numbers to be uniformly distributed in the $(a,b)$ interval, the easiest functions to use are RandomReal to get real numbers, or RandomInteger to get integer values. These functions are similar to the RAND() function in Excel or similar spreadsheets. RandomVariate is ...


2

Use Export["data1.mat", WW1] Export["data2.mat", WW2] Is that what you want? Or combined them into a single matrix using Mathematica, then export the whole matrix. But without the double quotes.


1

Finally, after many attempts, I had the answer: the ConversionOptions have to be assigned to "XHTML" and not to "HTML". Indeed, this works: ConversionOptions->{ "ExportOptions"->{"XHTML" -> {"ConversionRules" -> {"ItemNumbered" -> {"<li>", "</li>"}, "Text" -> {"<p class=\"mytext\">", "</p>"}}, ...


4

The easiest way (I think) is to set bookmarks. Then Export will interpolate between them. Export["try.swf", Manipulate[ Plot[Sin[2*x + φ], {x, 0, 10}], {{φ, 5.2308285471612335}, 0, 2*Pi}, Bookmarks -> {"start" :> {φ = 0.}, "stop" :> {φ = 2. Pi}}]]


2

You can always deploy your plot in the "CloudCDF" format. CloudDeploy[ ExportForm[ Plot3D[Abs[Gamma[x + I y]], {x, -4, 4}, {y, -3, 3}, PlotRange -> {0, 6}, Mesh -> None, ColorFunction -> "Rainbow", MaxRecursion -> 5, BoxRatios -> {4, 3, 3} ], "CloudCDF" ], Permissions -> "Public" ] ...


2

At the risk of raising a question from the grave its worth noting that this has been clarified/corrected at some point. Its not clear whether it was just a typo in the Help or its later functionality. If you look at the XLSX help, the 4th Basic Example shows the correct syntax with Rules. Export["test2.xls", "Sheets" -> {"list1" -> list1, "list2" ...


2

This is a quick and dirty version for what I think you are trying to do. Note that its not good Stack Exchange practise to keep asking variations of the question. One caveat with the Export help is that most useful stuff is held under each file format - so try looking at the help for XLSX. a = {"WMO44203", "WMO44207", "WMO44212"}; dset = WeatherData[#, ...


0

As Albert Retey notes in a comment, this seems to be a bug specific to version 7 (or perhaps just 7.0.1), given that this behavior is not observed in versions 6.0.2, 8.0.4, 9.0.1 or 10.0.2. Incidentally, you are absolutely right that the file is not exported correctly. If you use a different version to create it as it should be, version 7 will then be able ...



Top 50 recent answers are included