- 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
Clear text typed with input() from the command history
조회 수: 2 (최근 30일)
이전 댓글 표시
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
José-Luis
2014년 6월 10일
편집: José-Luis
2014년 6월 10일
A solution that's worse than the problem:
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
2014년 6월 13일
댓글 수: 3
Rasmus
2014년 11월 19일
I'm quite new to matlab and tires to use this code. There are one annoying side effect with the code. After the commands are executed the password will still be in the command window so i need to hit esc to not accidentally type the password again and then it is stored in the history.
How did you get around this?
참고 항목
카테고리
Help Center 및 File Exchange에서 Environment and Settings에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!