File Exchange

image thumbnail

Save entire command history - Updated, Fast

version 1.1.0.0 (1.74 KB) by Alex R.
Saves a complete record of all commands.

1 Download

Updated 28 Nov 2014

View License

Inspired by http://www.mathworks.com/matlabcentral/fileexchange/9291-save-entire-command-history.
`preserve_history.m` maintains a complete record of the command history (MATLAB only maintains the last 20k worth of commands, so old commands are lost).
This package is much faster than the above original (uses regexp to match all content instead of line by line) and is compatible with Matlab R2014a and R2014b which save history in XML format. There is also no need to edit/copy any files, the entire process is automatic. You also don't need to copy the files to $MATLAB/toolbox/local/, which usually requires admin permissions.

To install, just extract the attached files to `%USERPROFILE%\Documents\MATLAB` (on Windows) or `~/Documents/MATLAB` (Linux, MacOSX), which should already be in your Matlab path by default.

The preserved history file is called `history_preserved.m` and will be placed in `%APPDATA%\Mathworks\MATLAB\R2014a` (Windows) or `~/.matlab/R2014a` (Linux, MacOSX).

If all goes ok, quitting/exiting Matlab will trigger `preserve_history.m` automatically. You can also manually execute `preserve_history.m`.

Tested in Windows, Linux and MacOSX.

Comments and Ratings (6)

Sam

Very useful, thanks :)

Adam Danz

Indeed, fast and useful. Thanks for sharing.

Adam Danz

Alex R.

@Peter Muellers, sure. However, this file can be set to save the history to a global location and thus seamlessly survive reinstallations, version upgrades, different operating systems and even different machines etc. I have it set to save on Dropbox and my saved history is about 15 MB (been using it since R2012a or so).

Plus, it saves into plain .m code which I think is more useful, especially for quick and dirty work (the new XML format introduced in R2014a is not so human friendly)

In R2011a the history save limit was increased from 20K bytes to 200K bytes. More recently in R2014a the limit was changed to 25,000 commands but can be increased to as many as 1,000,000 commands via the Command History Preferences.

Updates

1.1.0.0

Corrected wrong file.

MATLAB Release Compatibility
Created with R2014b
Compatible with any release
Platform Compatibility
Windows macOS Linux
Acknowledgements

Inspired by: Save Entire Command History

Inspired: HxSearch