How can I access the saved command history in MATLAB?

Illustration
dpb - 2023-12-23T23:03:49+00:00
Question: How can I access the saved command history in MATLAB?

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

Expert Answer

Profile picture of Neeta Dsouza Neeta Dsouza answered . 2025-11-20

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

 


Not satisfied with the answer ?? ASK NOW

Get a Free Consultation or a Sample Assignment Review!