Home Manual Packages Global Index Keywords Quick Reference Language Reference Function Reference I/O Reference Opening and Closing Text Files Reading Text Writing Text Positioning a Text File Opening and Closing Binary Files Saving and Restoring Variables Reading History Records Writing History Records Opening Non-PDB Files Making Plots Plot Paging and Hardcopy Setting Plot Limits Managing Graphics Windows Graphics Query, Edit, and Defaults | # Yorick Language Reference ## Saving and Restoring Variables
`save, f, var1, var2, ..., varN` | saves the varI in binary file f
`restore, f, var1, var2, ..., varN` | restores the varIfrom f
`save, f` | saves all array variables in binary file f
`restore, f` | restores all variables from binary file f
Unlike f.varI `=` expr, the `save` function will create the variable varI in the file f if it does not already exist. The `restore` function redefines the in-memory varI . If several binary files are open simultaneously, the f.varI syntax will be more useful for reading variables than the `restore` function. Note that a single command can be used to create a binary file, save variables varI in it, and close the file: `save, createb(filename), var1, var2, ..., varN` A similar construction using `restore` and `openb` is also useful.