How do I clear the command history from the command line in MATLAB?

62 ビュー (過去 30 日間)
I would like to clear the command history from the command line in MATLAB.

採用された回答

MathWorks Support Team
MathWorks Support Team 2009 年 6 月 27 日
In MATLAB 7.0 (R14), the following command will clear the Command History:
com.mathworks.mlservices.MLCommandHistoryServices.removeAll;
In MATLAB 6.5 (R13), use the following command:
com.mathworks.ide.cmdline.CommandHistory.deleteAllHistoryForDesktop;
Please note that the use of these commands is not supported, and they may change in a future release.
  1 件のコメント
Jacob Lynch August
Jacob Lynch August 2019 年 3 月 21 日
This is really useful, since I often have to input a password to read an encrypted file. Is there a way to just delete only the previous line from the command history?
Looking at the methods of MLCommandHistoryServices, I see there are add, getAllHistory, getSessionHistory, and removeAll. It looks like I could get all history, remove all history, then iteratively add each element, shy of the last one to accomplish this, but I'm hoping there is a smarter option.

サインインしてコメントする。

その他の回答 (1 件)

drummer
drummer 2018 年 7 月 10 日
just type clc . It will clear your history window in matlab. If you want to clear the data as well, type: clc, clear
  2 件のコメント
Jacob Lynch August
Jacob Lynch August 2019 年 3 月 21 日
That's not useful if you're calling a function that takes a secret phrase for input, e.g. opening an encrypted file.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeFunction Creation についてさらに検索

製品

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by