According to this link:
How to save the contents of the windows of MATLAB commands in a file?
I can back up my comments in the future using diary , which is great:
diary
However, I would also like to back up the existing command history, I believe that the command history is stored in a text file somewhere right? If so, can I just copy it?
Take a look at "Save All Command History" , which will allow you to save the entire command history, not just the last 20k allowed by MATLAB.
Type prefdir in Matlab and it will provide you with a folder.
prefdir
The history of your team is located in this folder in a file called history.m .
history.m