Info

Cette question est clôturée. Rouvrir pour modifier ou répondre.

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

1 vue (au cours des 30 derniers jours)
Pu Andaes
Pu Andaes le 13 Sep 2020
Clôturé : MATLAB Answer Bot le 20 Août 2021
I'm kind of new to MATLAB, how can I show the users' inputted data on a disp or fprintf function?
  4 commentaires
Walter Roberson
Walter Roberson le 14 Sep 2020
disp() only accepts one parameter. But you can
disp(['Your answer is: ', num2str(ans)])

Réponses (1)

KSSV
KSSV le 13 Sep 2020
Modifié(e) : KSSV le 13 Sep 2020
prompt = "Hey user, input a number: ";
num = input(prompt) ;
fprintf("User, you have entered %f\n",num)

Cette question est clôturée.

Community Treasure Hunt

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

Start Hunting!

Translated by