Save workspace variables to file
save(
saves
all variables from the current workspace in a MATLAB® formatted
binary file (MAT-file) called filename
)filename
. If filename
exists, save
overwrites
the file.
save
is the
command form of the syntax. Command form requires fewer special characters.
You do not need to type parentheses or enclose the input in single
quotes. Separate inputs with spaces instead of commas.filename
For example, to save a file named test.mat
,
these statements are equivalent:
save test.mat % command form save('test.mat') % function form
You can include any of the inputs described in previous syntaxes.
For example, to save the variable named X
:
save test.mat X % command form save('test.mat','X') % function form
Do not use command form when any of the inputs, such as filename
,
are variables.