フィルターのクリア

How can I use a floating point number with input command?

18 ビュー (過去 30 日間)
Gavin Thompson
Gavin Thompson 2021 年 10 月 12 日
コメント済み: Gavin Thompson 2021 年 10 月 12 日
L = 10
a = input('Enter the location of the force (0 - %0.2f meters): ');
How can I get the prompt to output as 'Enter the location of the force (0 - 10.00 meters): '.

採用された回答

Stephen23
Stephen23 2021 年 10 月 12 日
L = 10;
S = sprintf('Enter the location of the force (0 - %0.2f meters): ',L);
a = input(S);
  1 件のコメント
Gavin Thompson
Gavin Thompson 2021 年 10 月 12 日
Ahh that makes sense, I tried using sprintf before but I put it on the outside so I got an error. Thank you!

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeCharacters and Strings についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by