User input and print question
11 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
I have the following code that I want it to print "Air density = x.xx kg/m^3" and "Blade radius = x.xx cm." Is it possible to add the 'kg/m^3' and 'cm' so it prints after the user entered numbers or should I be using a different input prompt?
density = input('Air density = ');
radius = input('Blade radius = ');
0 commentaires
Réponses (2)
Renato Agurto
le 19 Avr 2016
Modifié(e) : Renato Agurto
le 19 Avr 2016
Try using fprintf with \b (backspace) to "remove" the newline
density = input('Air density = ');
fprintf('\b kg/m^3\n');
radius = input('Blade radius = ');
fprintf('\b cm\n');
1 commentaire
Walter Roberson
le 19 Avr 2016
I have not seen any terminal since the ADM3A on which backspace removed a newline.
Voir également
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!