Clear text typed with input() from the command history
Mostra commenti meno recenti
The case scenario is very simple, I am asking for a password to be typed in the command window.
I am using
s = input('Password: ','s')
I can clear the text from the command window with something like fprintf(char(8)), but how do I clear the last typed command from the command history ?
I am aware that inputdlg() would solve the problem but I would be interested in finding some way for editing the history.
EDIT
I personally changed approach from cmd window input to GUI input and wrote a submission for the purpose: http://uk.mathworks.com/matlabcentral/fileexchange/47210-passfield

2 Commenti
A solution that's worse than the problem:
- Do your thing
- Close Matlab
- Modify the command history file history.m (delete last line). Use prefdir() to find where it is located.
- Reopen Matlab
I don't know if there's a way to force the IDE to update the command history. That way opening and closing Matlab wouldn't be necessary.
Oleg Komarov
il 10 Giu 2014
Risposta accettata
Più risposte (1)
It may be a bit violent but
com.mathworks.mlservices.MLCommandHistoryServices.removeAll
would work.
And welcome back! ;-)
1 Commento
Oleg Komarov
il 10 Giu 2014
Categorie
Scopri di più su Text Files in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!