How to run loop until user enters text in the command window? (without using the input function)

15 次查看(过去 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 个评论
Brian
Brian 2023-10-16
I don't want the script to pause--basically I want the script to run continuously until something is entered in the command window which would lead to breaking the loop.
Seems someone else asked the same question already with no proper answer:
https://www.mathworks.com/matlabcentral/answers/4896-using-command-prompt-during-running-script

请先登录,再进行评论。

采纳的回答

Mario Malic
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 CenterFile Exchange 中查找有关 Loops and Conditional Statements 的更多信息

标签

产品


版本

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by