How to run loop until user enters text in the command window? (without using the input function)
조회 수: 8 (최근 30일)
이전 댓글 표시
I want a script to run in a loop until the user enters something in the command window, at which point the loop will break and continue with the rest of the script. Perhaps there is a line in the loop where it "looks" at the command window's "buffer?" I don't want to use the input function because I don't want the user to be prompted every time the loop runs.
Thanks!
댓글 수: 3
Rik
2023년 10월 17일
It might be possible to read the command history in your loop. Have you tried that?
채택된 답변
Mario Malic
2023년 10월 17일
편집: Mario Malic
2023년 10월 17일
Undocumented and subject to change but it works, at least when it was tested back then https://uk.mathworks.com/matlabcentral/answers/545957-copy-matlab-command-window-without-diary#answer_568048
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!