Info

この質問は閉じられています。 編集または回答するには再度開いてください。

How do I show the variables the users' inputted in a disp or fprintf fucntion?

2 ビュー (過去 30 日間)
Pu Andaes
Pu Andaes 2020 年 9 月 13 日
閉鎖済み: MATLAB Answer Bot 2021 年 8 月 20 日
I'm kind of new to MATLAB, how can I show the users' inputted data on a disp or fprintf function?
  4 件のコメント
Walter Roberson
Walter Roberson 2020 年 9 月 14 日
disp() only accepts one parameter. But you can
disp(['Your answer is: ', num2str(ans)])
Pu Andaes
Pu Andaes 2020 年 9 月 18 日
Thank you!

回答 (1 件)

KSSV
KSSV 2020 年 9 月 13 日
編集済み: KSSV 2020 年 9 月 13 日
prompt = "Hey user, input a number: ";
num = input(prompt) ;
fprintf("User, you have entered %f\n",num)

この質問は閉じられています。

Community Treasure Hunt

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

Start Hunting!

Translated by