Using clc in my simple scipt prevents user input question being displayed

1 回表示 (過去 30 日間)
Nick
Nick 2025 年 1 月 14 日
コメント済み: Cris LaPierre 2025 年 1 月 15 日
I wrote a simple script to ask for a user's age
age = input('What is your age?....')
This works as expected.
However, if I insert a clc in front of this in the code, it does not display the question to the user in the command window. I don't know what is happening here.
Any thoughts?
Thanks
Nick

採用された回答

Voss
Voss 2025 年 1 月 14 日
The behavior you describe happens for me only in MATLAB Online. You can include a short pause after clc to get the input prompt to show up, e.g.:
clc
pause(0.1)
age = input('What is your age?....')
  3 件のコメント
Voss
Voss 2025 年 1 月 14 日
You're welcome!
Cris LaPierre
Cris LaPierre 2025 年 1 月 15 日
I see this has already been reported internally.

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

その他の回答 (0 件)

カテゴリ

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

タグ

製品


リリース

R2024b

Community Treasure Hunt

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

Start Hunting!

Translated by