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

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 件のコメント

Nick
Nick 2025 年 1 月 14 日
Thanks for this, brilliant
Voss
Voss 2025 年 1 月 14 日
You're welcome!
Cris LaPierre
Cris LaPierre 2025 年 1 月 15 日
I see this has already been reported internally.

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

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeIntroduction to Installation and Licensing についてさらに検索

製品

リリース

R2024b

タグ

質問済み:

2025 年 1 月 14 日

コメント済み:

2025 年 1 月 15 日

Community Treasure Hunt

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

Start Hunting!

Translated by