Effacer les filtres
Effacer les filtres

How to use input command?

4 vues (au cours des 30 derniers jours)
Shawn Simon
Shawn Simon le 23 Oct 2015
Commenté : Shawn Simon le 23 Oct 2015
The purpose of these two lines is for the user to input the name the "planet", then the next question asks the mass of the planet. In the second line, I am trying to call the variable 'name' so the question in line 2 incorporates the name of the planet. However, I get an error on the second line saying "Too many input arguments". Also, I am new to MATLAB. Please help
name = input('What is the name of the exoplanet? ', 's');
massplanet = input('What is the estimated mass of %s (kg)? ', 's', name);

Réponse acceptée

Adam
Adam le 23 Oct 2015
Modifié(e) : Adam le 23 Oct 2015
massplanet = input( sprintf('What is the estimated mass of %s (kg)? ', name), 's');
  1 commentaire
Shawn Simon
Shawn Simon le 23 Oct 2015
Thank you so much for your help and fast response!

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Earth and Planetary Science dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by