If you ever need to search through the MATLAB command history you can do it in the following way.
To accomplish it in a programmatic and platform-independent manner, you can first use MATLAB’s Java internals to get the command history as a character array:
history = com.mathworks.mlservices.MLCommandHistoryServices.getSessionHistory; historyText = char(history);
Then you can search through the character array however you like, using functions like STRFIND or REGEXP. You can also turn the character array into a cell array of strings (one line per cell) with the function CELLSTR, since they can sometimes be easier to work with.
Changing the last line to
.getAllHistory should get you the whole history, whereas the previous one will get you just the history from the current session.
history = com.mathworks.mlservices.MLCommandHistoryServices.getAllHistory;