Hot answers tagged

15 votes

DumpSave for the forgetful

Method 1: Enable messages for new symbols and load MX file The following code will load MX file and show a General::newsym message for each newly created symbol. <...
Ray Shadow's user avatar
  • 7,806
8 votes

How to convert a Mathematica list in a Python list?

ExportString[var, "RawJSON", "Compact" -> True] [[1,[1,0]],[2,[0,0,0]],[3,[2,3]],[4,[4,5,6]],[5,[7,8,9]]] Update And ...
yode's user avatar
  • 26.5k
7 votes

Symbolize Does Not Work in `.m` Files or What?

This answer may seem slightly off but it was posted before recent updates. The bottom line holds though. It symbolizes boxes, not expressions, it is not Subscript ...
Kuba's user avatar
  • 137k
7 votes

Is it possible to recover an unsaved notebook after closing it?

If your notebook is hung/non-responsive, and you haven't saved changes, don't give up! You can try to kill the kernel processes without killing Mathematica and revive it. I just did this on MacOS ...
Brad's user avatar
  • 71
7 votes
Accepted

DumpSave'ing while lengthy program runs

You can use Get/@ FileNames["save*"].
Henrik Schumacher's user avatar
7 votes
Accepted

How to save/load (export/import) symbolized variables?

You could just save global variables and Subscript: Save[file, {"`*", "Subscript"}] If you really want to use the ...
Carl Woll's user avatar
  • 130k
7 votes

Mathematica and Google Drive backup client

I've been having the same problem. Disabling "FileChangeProtection" seems to solve it for me: ...
Evert Bosdriesz's user avatar
6 votes
Accepted

Trace and TracePrint are slow, How to Trace to a file for speed

This will call TraceScan and save each line (WriteLine) to a text file. A time-out can be defined (default 1 minute), and the ...
rhermans's user avatar
  • 36.3k
6 votes

How do I save the generated 2d random array for the next use?

Add this simple code before u run everything will let Random generate exactly the same result every time you run. If you're careful enough, you may find this in lot's of posts with randomly generated ...
Wjx's user avatar
  • 9,558
6 votes
Accepted

Saving functions in .m file(s)

You need to use symbols or lists of symbols as the second argument of Save. So for: f[a][x_] := x^2 you would use: ...
Carl Woll's user avatar
  • 130k
6 votes
Accepted

Save loop output in a data file

It is better to avoid For loops. And why not just use Export? And try to not use l for ...
Nasser's user avatar
  • 142k
5 votes

DumpSave'ing while lengthy program runs

Get /@ StringTemplate["save``"] /@ Range[1, 5]
Johu's user avatar
  • 4,908
5 votes

How to save expression with its name

You can use Save in this way: ...
CA Trevillian's user avatar
4 votes

Alternative to Dump Save

For large matrices of numeric values, I suggest to export to the MATLAB MAT-format. This is a binary format for matrices (and tensors) only and thus, it is much faster than exporting arbitrary symbols....
Henrik Schumacher's user avatar
4 votes

Symbolize Does Not Work in `.m` Files or What?

The Notation package relies on Box Form as used by the Front End. Packages (generally) do not use Box Form therefore the Notation package does not work there. If you start ...
Mr.Wizard's user avatar
  • 271k
4 votes
Accepted

Saving and loading lists of interpolating functions fast and cross-platform

While I was writing my question, I found a solution. I can use Export and Import. ...
Louis Yang's user avatar
4 votes
Accepted

How do I save the generated 2d random array for the next use?

As a general solution, you can always Export you data to a file. ...
Sumit's user avatar
  • 15.9k
4 votes
Accepted

Stop PaletteNotebook from asking to save changes

Simply add the option Saveable -> False: ...
M.R.'s user avatar
  • 31.4k
4 votes

Backing up and restoring all Mathematica notebook variables using 'Put' '>>' and 'Get' `<<`

You could introduce a wrapper: Dump /: Put[Dump[objects_], file_] := DumpSave[file, objects] Then: ...
Carl Woll's user avatar
  • 130k
4 votes

How can I see what Get restored?

You could use TracePrint: a=2; b=3; c[x_]:=x^2 Save["tst.m", {a,b,c}]; TracePrint[ Get["tst.m"], _Set | _SetDelayed ] ...
Carl Woll's user avatar
  • 130k
4 votes
Accepted

How to retrieve values of a function from a file

You can use Get (<<) to retrive the contents of the file "q5e8": <<name reads in a file, evaluating each ...
kglr's user avatar
  • 392k
4 votes

how to save a file in STL format

Export["a.stl", DiscretizeGraphics[model]]
Henrik Schumacher's user avatar
3 votes
Accepted

Store large symbolic data in a binary format efficiently?

Look at BinarySerialize, particularly the option PerformanceGoal -> "Size". It's even better than ...
rhermans's user avatar
  • 36.3k
3 votes

How to save values in dynamic fields?

As @Kuba says in the comments, use DynamicModule with the SaveDefinitions->True option: ...
Carl Woll's user avatar
  • 130k
3 votes
Accepted

Interpolate and save a vector function

Use Save: f[x] := {Cos[x],Sin[x],Tan[x],Cot[x],SomeComplicatedInterpolationFunction[x]}; Save["f.m", f] Let's check if it ...
Carl Woll's user avatar
  • 130k
3 votes

How to convert a Mathematica list in a Python list?

Standard Method To safely and automatically transfer large data, you should do as Phillipp mentioned, by using the following: Export["myListFile.csv", myList] ...
Miladiouss's user avatar
  • 1,873
3 votes

Saving notebook, excluding output cells, without losing "working notebook" output cells

Simon's answer provides a good way to save clean versions of the file one is working on, but it is not particularly easy to automate. In particular, I was looking for a way to store two copies of the ...
Emilio Pisanty's user avatar
3 votes

How to write crash-robust code?

If you can keep a cell on screen, Dynamic can do it. Perhaps not the prettiest of methods, but here's one possible approach: ...
eyorble's user avatar
  • 9,373
3 votes
Accepted

Save only RHS of equation

Your expression f = a*x + Exp[x] is an assignment to the variable f, not an equation. If you save ...
m_goldberg's user avatar
  • 108k
3 votes
Accepted

Avoid an Error Message when Importing

I'm new and this is my 1st answer. Try the following: ...
uC-Harry's user avatar
  • 239

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