MATLAB: Running a command in the console so it appears in the history

history

Hi,
com.mathworks.mlservices.MLCommandHistoryServices can be used to get and remove the history but is there a way to append something? For example, I'd like to run '%foo bar' in the command console and and have it appear as the last line in history (up key recovers it).
com.mathworks.mlservices.MLExecuteServices.consoleEval allows me to evaluate something in in the context of the console but it doesn't get appended to the history.
Any ideas?
Thanks

Best Answer

Self-update: you can do it with com.mathworks.mlservices.MLExecuteServices.executeCommand().
Related Question