MATLAB: How to access the saved command history in MATLAB

MATLAB

I have a number of commands appearing in my Command History window, which I would like to extract for other uses.

Best Answer

Prior to MATLAB R2014a the "history.m" file in the preference directory stores all the commands from the command history. Starting with MATLAB R2014a the commands are stored in an XML file history.xml in the preference directory. The location of the directory can be found by executing the following on
MATLAB command prompt.
>>prefdir
The following is a MATLAB file exchange submission which users may found useful to search for terms in the MATLAB command history.