save

save(filename) saves all the workspace variables in a file. If a second argument is defined, save(filename, var) takes only variables specified in var.

Examples

> x = 1; y = 2; z = 3;

[x:1]
[y:2]
[z:3]

> save('variables')

> clear

> load('variables')

[x:1]
[y:2]
[z:3]

> x; y; z;

[x:1]
[y:2]
[z:3]
> a = 'abc'; b = 'ABC'; c = 'def'

[a:abc]
[b:ABC]
[c:def]

> save('variables_ab', {'a', 'b'})

> clear

> load('variables_ab')

[a:abc]
[b:ABC]

> c#

undefined function or variable "c" - line 1

Resources

See also

clear | load