Category Archives: Mathematica

Mathematica memo – Saving data using “FileSave”

It’s great to automatically save an output at the end of a script. It is sometimes desirable to run the script multiple times, saving the data under a new filename. It’s simple to generate new filenames using the date etc. If the script were to be used regularly by multiple people, with different file naming tastes, it maybe useful to use a dialog box to export data. This avoids people screwing with your script to add different filenames and can be done using a single line of code

Export[SystemDialogInput["FileSave",
       "/home/cswinson/Desktop/data.m"], data]

This pops up a dialog box with a preset file path and suggested filename.