DIARY Save text of MATLAB session.
DIARY filename causes a copy of all subsequent command window input and most of the resulting command window output to be appended to the named file. If no file is specified, the file ‘diary’ is used.
DIARY OFF suspends it.
DIARY ON turns it back on.
DIARY, by itself, toggles the diary state.
Use the functional form of DIARY, such as DIARY(‘file’),
when the file name is stored in a string.