To store and retrieve the state of your session, save filename and load filename write and read filename.mat. The file matlab.mat will be used if filename is omitted. Default .mat files are not human-readable; see help save and help load for other uses, including ASCII formats and partial-state operations.
If you want to keep a record of your session, diary filename will store in filename (using the file ``diary'' if filename is omitted) everything that appears in the MATLAB xterm afterwards. (Graphics are not recorded.) diary off will turn off this recording until restored with diary on. (Or plain diary to toggle between these.) The diary is plain text, so your favorite text editor can be used on it.