save
Save workspace variables to a file.
Syntax
Section titled “Syntax”savesave(filename)save(filename, var1, var2, ...)save(filename, '-options')Description
Section titled “Description”Saves variables from the current workspace to disk. Without arguments, saves all variables to matlab.mat. With a filename, saves to that file. With variable names, saves only those.
The '-options' form supports flags: '-mat' (binary MAT format, default), '-ascii' (text), '-append' (add to existing file without overwriting), '-v7.3' (HDF5-based for files >2GB).
Examples
Section titled “Examples”savesave('data.mat', 'x', 'y')save('data.txt', 'A', '-ascii')